-
Notifications
You must be signed in to change notification settings - Fork 117
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
ZonedDateTime: ZoneId vs ZoneOffset behaviour #244
Comments
It would seem ideal if the same representation would be returned with round-trip processing, but perhaps there are technical problems with that. I do not recall this being brought up before. But one quick question: is the actual point-in-time still correct? (ignoring the different in representation of the timezone information). If not, that would be a bigger problem. |
Thanks for a quick response. I believe it is the same point in time, however I must admit I don't have an in-depth knowledge of |
Right, I would expect internal point in time to be same, which is at least some consolation. Still, a PR for (failing) test case would be useful; I could check that in (under |
I added a test case #245 |
I looked into this a bit more. Since by default, the date gets serialized into a decimal representation, e.g. There is another use case, deserializing dates in string format, such as ZonedDateTime.parse("2022-06-18T10:11:46.583714647-07:00") // => 2022-06-18T10:11:46.583714647-07:00
ZonedDateTime.parse("2022-06-18T17:11:46.583714647Z[UTC]") // => 2022-06-18T17:11:46.583714647Z[UTC] Then with I updated the test case to reflect this. |
see #267 for an in-depth explanation. I think these issues are related. In this case you may want to try disabling DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE. The default timezone in jackson is UTC, and by default the deserializer will adjust the zone to match the context's timezone. |
@dscalzi thank you for looking into this. I'll try your suggestion. |
FWTW, I implemented #281 which allows disabling |
This issue is related to serializing
ZonedDateTime
with aZoneOffset
. When the same value is deserialized, we get backZonedDateTime
with aZoneId
instead. As a result, the seralized and deserialized dates are not equal.Wanted to confirm whether this is a bug. If not, is there a recommended workaround?
Test case: https://github.com/armandino/jackson-modules-java8-bug-report
The text was updated successfully, but these errors were encountered: