Skip to content

Discrepancy in deserialization of ZonedDateTime #204

Closed
@dscalzi

Description

Given input string: 2021-02-01T19:49:04.0513486Z

Jackson will deserialize a ZonedDateTime with the following properties:

  • offset: "Z" (type ZonedOffset)
  • zone: "UTC" (type ZoneRegion)

Using the standard call

DateTimeFormatter.ISO_ZONED_DATE_TIME.parse(inputString, ZonedDateTime::from);

produces:

  • offset: "Z" (type ZonedOffset)
  • zone: "Z" (type ZonedOffset)

This causes an issue in comparisons because id value "UTC" != id value "Z". This also produces a redundancy in the toString of the ZonedDateTime because it detects that the offset != zone.

toString for Jackson result: 2021-02-01T19:49:04.051348600Z[UTC]
toString for standard result: 2021-02-01T19:49:04.051348600Z

The latter can be consumed without extra processing and is the desired result.

Would it be possible to update the deserializer to behave like the standard call?

Metadata

Assignees

No one assigned

    Labels

    date-time-configWork related to possible larger DateTimeConfig feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions