JavaScript iso8601 Date Parsing (xbrowser polyfill)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


date_iso8601_polyfill.js  - original version of the polyfill compatible with ES5.1 spec

date_iso8601_polyfill_es6.js  - updated version of the polyfill compatible with ES6 spec

polyfilling JavaScript's subset of iso8601 dates to work on all browsers - ck 2/7/2012

the new version that is compatible with ES6 assumes dates are in local time when no
timezone specifier is given.  this is more inline with what the actual iso8601 standard
says... for a more detailed explanation see below.

original testing ground (ES5.1 version):


--- Microsoft Connect requires login to view:

IE9 had an issue where it didn't accept milliseconds correctly: (fixed in IE10)
still an issue in IE10:
  - IE team basically said *won't fix*... read below as to why..

--- Test a browser to see if the shim will be used:

---! Standards aren't standard until they're standard... OH SNAP!

it would seem that the ECMA folks seemed to have changed their mind on what the spec should say for ECMAScript-262 v6.0

this is very ironic because I seemed to have banged heads with someone on github about this exact detail.  It breaks 
down like this:  

iso8601 says: "Times without a timezone specification, be it a 'Z' or and actual offset, are assumed 
to be in local time.  This can be ambiguous and result in unwanted behavior unless you know that both 
the communicator and reciever are guranteed to be in the same timezone, as such a timezone should 
always be specified, even though it is optional."... or something like that, lol.

ECMAScript-262 v5.1 says: "The value of an absent time zone offset is “Z”."

ECMAScript-262 v6 says: "If the time zone offset is absent, the date-time is interpreted as a local time."

crap... well ES6 is so new it's still in "early draft" status and right now and the browsers breakdown like this:

ES5.1 compliant date parsing: chrome, mobile safari, opera
ES6.0 compliant date parsing: IE10, firefox, desktop safari

... like i said, crap.

Anyway I'm putting up a second vresion of this file that is compliant with ES6 spec, you can decide for
yourself which you would rather use... either one will "shim" the "non-comliant" versions into compliancy