Here’s the sample code:
var d = new Date("2010-06-09T19:20:30+01:00");
document.write(d);
On FF3.6 this will give you:
Wed Jun 09 2010 14:20:30 GMT-0400 (EST)
Other browers tested; Chrome 5, Safari 4, IE7 give:
Invalid Date
I know there is limited to no support for ISO8601 dates, but does anyone know what and/or where the difference is in FF3.6 that allows this to work?
My thought is that FF is just stripping out what it doesn’t understand while the others are not.
Has anyone else seen this and/or getting different results from the test script?
ECMAScript 5th edition (see §15.9.1.15) adds some support for ISO-8601, and Mozilla has apparently jumped on it (they may even have been the ones pushing it). I didn’t think they’d added it to the constructor, and the support is supposed to be a bit simplified, but that doesn’t mean Mozilla can’t go with the spirit rather than the letter and take anything it can figure out — or thinks it can figure out. The actual format supported in the spec is
YYYY-MM-DDTHH:mm:ss.sssZ. Your sample date is not quite a match.