var date1 = new Date("Dec 29, 2016");
var date2 = new Date("2016-12-29");
console.log(date1);
//This prints "Thu Dec 29 2016 00:00:00 GMT-0500 (EST)"
console.log(date2);
//This prints "Wed Dec 28 2016 19:00:00 GMT-0500 (EST)"
console.log(date1 == date2);
//Prints false
How do I parse dates correctly in the above code so that the two dates are considered equal.
Looks like date2 object is not created correctly the way I want. How do I correct this?