Here is my javascript code:
var prevDate = new Date('1/25/2011'); // the string contains a date which
// comes from a server-side script
// may/may not be the same as current date
var currDate = new Date(); // this variable contains current date
currDate.setHours(0, 0, 0, 0); // the time portion is zeroed-out
console.log(prevDate); // Tue Jan 25 2011 00:00:00 GMT+0500 (West Asia Standard Time)
console.log(currDate); // Tue Jan 25 2011 00:00:00 GMT+0500 (West Asia Standard Time)
console.log(prevDate == currDate); // false -- why oh why
Notice that both dates are the same but comparing using ==
indicates they are not the same. Why?