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

Deserialization of ZonedDateTime may lose zone information #118

Closed
hohwille opened this issue Jul 5, 2019 · 6 comments
Closed

Deserialization of ZonedDateTime may lose zone information #118

hohwille opened this issue Jul 5, 2019 · 6 comments

Comments

@hohwille
Copy link

hohwille commented Jul 5, 2019

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 deserialize ZonedDateTime.

See also devonfw/devon4j#116

@cowtowncoder
Copy link
Member

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.

@cowtowncoder cowtowncoder added the good first issue Issue that seems easy to resolve and is likely a good candidate for contributors new to project label Oct 9, 2019
@cowtowncoder
Copy link
Member

I think that this might be good issue for new contributors to investigate.

@cowtowncoder cowtowncoder changed the title Deserialization of ZonedDateTime may lose zone information Deserialization of ZonedDateTime may lose zone information Oct 9, 2019
@kupci
Copy link
Member

kupci commented Oct 26, 2019

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

@kupci kupci added documentation Issue that documentation improvements could solve or alleviate and removed documentation Issue that documentation improvements could solve or alleviate labels Oct 26, 2019
@kupci
Copy link
Member

kupci commented Oct 26, 2019

@kupci
Copy link
Member

kupci commented Nov 5, 2019

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.

@kupci kupci closed this as completed Nov 5, 2019
@hohwille
Copy link
Author

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 👍

@cowtowncoder cowtowncoder removed the good first issue Issue that seems easy to resolve and is likely a good candidate for contributors new to project label May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants