Skip to content
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

OffsetDateTime JSON serialisation format is not parsable in JavaScript #284

GoogleCodeExporter opened this issue Mar 15, 2015 · 4 comments


Copy link

As noted in, the JSON serialisation format 
for OffsetDateTime produces output such as "2014-05-16T07:28:51+02" (it uses 

However, ECMA-262 requires that the offset be specified including the minutes 
(see, and at 
least Chrome fails to parse the string otherwise:

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

(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 by malcolm.rowe on 24 May 2014 at 9:04

Copy link

Right.  I believe this is also a requirement of RFC3339.

Original comment by mj1856 on 24 May 2014 at 4:39

Copy link

Original comment by malcolm.rowe on 30 May 2014 at 8:37

  • Added labels: Milestone-1.3.0
  • Removed labels: Milestone-1.3-consider

Copy link

Fixed the Json.NET representation in revision a24b462035cd.
However, I've just tried this for the XML representation, and that has the same 
issue - in particular, the conversion from XElement to DateTimeOffset fails 
unless the offset is in HH:mm format.

It's unfortunate that we won't be able to round-trip values, but I think we 
should change the XML representation too...

Original comment by jonathan.skeet on 30 May 2014 at 4:49

Copy link

XML representation changed in revision ce2d2662a0b0. I think we're done now; 
I'm not changing any non-serialization formats at the moment.

Original comment by jonathan.skeet on 31 May 2014 at 1:24

  • Changed state: Fixed

@malcolmr malcolmr added the bug label Mar 15, 2015
@malcolmr malcolmr modified the milestone: 1.3.0 Mar 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants