I am trying to figure out why Date.parse (javascript) returns NaN when applied to a seemingly valid ISO 8601 date string when IE9 is in Quirks Mode. It works fine in Standards mode.
//ReturnsNaN in Quirks Mode, 1270574382557 in Standards Mode
document.write(Date.parse("2010-04-06T17:19:42.557"));
//Returns NaN in Quirks Mode, 1270512000000 in Standards Mode
document.write(Date.parse("2010-04-06"));
In contrast, the following works in both Quirks and Standards for me
//Returns 1270549182000 in both Quirks and Standards Modes
document.write(Date.parse("2010/04/06T17:19:42"));
Is anybody else seeing this behavior? If so, any ideas on why Date.parse is returning NaN?
First of all you should understand that quirks mode is basically an IE5 compatibility mode.
It is triggered by not having a valid declaration. The main effect is that it causes the browser to use the IE5 box-model, which means that all your paddings, margins and borders, and anything else which affects the size of a box will be incorrect.
So your Date.parse doesn't work because there were no such feature - "parse ISO 8601 date" at those dates.