This question already has an answer here:
I cannot figure out why
ls_a === a is returning
false in the code below. It seems like when I convert to a date to string and back to date, something is being lost, but what??
var a = new Date(); localStorage.a = a.getTime(); ls_a = new Date(parseInt(localStorage.a)); console.log(a); // Fri Jun 12 2015 22:12:34 GMT-0600 (MDT) console.log(ls_a); // Fri Jun 12 2015 22:12:34 GMT-0600 (MDT) console.log(ls_a === a); // returns false!?!?! console.log(ls_a.getTime() === a.getTime()); // returns true as expected