|
|
|
|
|
by TazeTSchnitzel
4629 days ago
|
|
>But since there's no specification for the format to use, cross-browser date parsing is a mess Wrong! Since ECMAScript 5 there is a single, standard format that all browsers will try to parse first and can predictably output: ISO 8601. --
[02:49:29.621] (new Date()).toISOString()
[02:49:29.623] "2013-10-12T01:49:29.623Z"
--
[02:49:40.233] JSON.stringify(new Date())
[02:49:40.245] ""2013-10-12T01:49:40.246Z""
|
|
In any case, my general point still stands: dates are the only "data" type (i.e. not a function, regex, etc.) which is not supported by JSON. So even if there were a usable universal serialization format, you'd still need to post-process the results of the JSON parser to convert the strings into dates.