Skip to content

OffsetDateTime JSON serialisation format is not parsable in JavaScript #284

Description

@GoogleCodeExporter
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions