It seems that when a date object is passed to the Date constructor in IE, it's evaluated as something other than the time value (probably calls toString
).
To force it to evaluate to the time value, you can do:
new Date(x.getTime());
or
new Date(+x);
or any expression that makes the date return its time value rather than a string.
When a single value is passed to the Date constructor, it's converted to a primitive. The specification doesn't say whether it should be converted to a string or number. So IE isn't non–compliant, it's just behaving differently.
It is unusual though that IE doesn't seem to correctly parse it's own string representation of a date in this case. It seems to fail for any date before 70-01-01, which may be moot since the Gregorian calendar was only introduced in 1582. The time value itself can cover dates from 283458 BC to 287396 AD.
Anyway, the fix is simple.
Edit 2016
In ES5, passing a Date to the Date constructor called Date.prototype.toString so the constructor then had to parse it's own string version of the date. ECMAScript 2015 fixed that so the time value is used directly instead.
However, not all browsers support ECMAScript 2015 yet so even though the chance of new Date(date)
returning an incorrect value are small and becoming smaller by the day, it's still safer to use +date
(until IE 8 is completely gone).