Closed hohwille closed 5 years ago
Did you try disabling DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE
? That was added to allow control over whether TimeZone
is to be unified or not.
I think that this might be good issue for new contributors to investigate.
@hohwille Did disabling the DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE
solve the issue for you? That looks like it should work, though I notice there isn't any documentation on this setting, or at least I couldn't find it, so I added a 'Documentation Needed' label to this item.
Found the documentation: https://github.com/FasterXML/jackson-databind/wiki/Deserialization-Features
With the update to the README, I think this can be closed. There are also a bunch of tests that exercise the functionality (@see TestZonedDateTimeSerialization
) though if additional tests are helpful, please re-open and they can be added.
Sorry for the late response but I can confirm that your suggestion fixed the issue. Thanks for the hint and great that you also updated to docs 👍
On Deserialization of ZonedDateTime the ZoneId is added as offset and lost resulting in "1999-12-31T23:59:59+02:00" being deserialized as "1999-12-31T21:59:59Z[UTC]". I traced it down to the root which is here: https://github.com/FasterXML/jackson-modules-java8/blob/master/datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/deser/InstantDeserializer.java#L209
IMHO one would need to use
ZonedDateTime.parse(CharSequence)
to properly deserializeZonedDateTime
.See also https://github.com/devonfw/devon4j/issues/116