Skip to content

OffsetDateTime JSON serialisation format is not parsable in JavaScript #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GoogleCodeExporter opened this issue Mar 15, 2015 · 4 comments
Labels
Milestone

Comments

@GoogleCodeExporter
Copy link

As noted in http://stackoverflow.com/q/23828573, the JSON serialisation format 
for OffsetDateTime produces output such as "2014-05-16T07:28:51+02" (it uses 
OffsetDateTimePattern.ExtendedIsoPattern).

However, ECMA-262 requires that the offset be specified including the minutes 
(see http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15), and at 
least Chrome fails to parse the string otherwise:

> Date.parse("2014-05-16T07:28:51+02")
NaN
> Date.parse("2014-05-16T07:28:51+02:00")
1400218131000

(The spec _also_ requires the milliseconds field, if present, to be three 
decimals, rather than the six we generate. However, that appears not to cause 
trouble in practice, so we might not want to change that.)

While JSON doesn't necessarily mean that you're parsing with JavaScript, it 
seems reasonable to at least consider changing the serialization format to 
always include the minutes.

Original issue reported on code.google.com by malcolm.rowe on 24 May 2014 at 9:04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants