play-json icon indicating copy to clipboard operation
play-json copied to clipboard

Properly support ISO8601 date/time strings for Java 8

Open diversit opened this issue 6 years ago • 0 comments

Java 8 does not properly support the ISO8601 standard. It does not support the zone formats 'HHMM' or 'HH'. This has been raised in this JDK Issue, but it has only been fixed in Java 9 and not for Java 8 (which everyone is still using).

Since Play Json's Reads type composes nicely, it is fairly simple to fix this so deserialising ISO8601 date/time strings to Java Time types does work as expected.

I already have the solution in our application. If this is something which could be added to this library, I'm more than happy to create a PR for it.

Play Json 2.6 Java 8

Expected:

  1. deserialise '2018-01-11T13:45:35.260+0100' to Java Time type
  2. deserialise '2018-01-11T13:45:35.260+01' to Java Time type

Actual behavior:

  1. ParseException
  2. ParseException

diversit avatar Mar 12 '18 11:03 diversit