-
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
Can't deserialize OffsetDateTime.MIN
: Invalid value for EpochDay
#308
Comments
same problem |
This seems like something that someone with time and interest could pick up -- PRs welcome! /cc @JooHyukKim in case you were looking for other things to work on :) |
I wasn't, but always willing 👌🏼 |
@JooHyukKim yeah don't feel like you should work on this; seems like you have many other things in-flight (and waiting for my reviews, some of them :-/ ) |
possible duplicate of #124 (see comments there, further down) |
OffsetDateTime.MIN
: Invalid value for EpochDay
@winfriedgerlach Related/overlapping, but since reported for different types -- and likely need separate (if possibly similar) fix, so will keep separate. And now we have linkage via refercens. ps. Thank you for going over issues to find closed/obsolete/overlapping issues. Can help clean up our issue trackers. |
Hello everyone, We looked into this problem and found that it is correlated with the timezone. The timezone of OffsetDateTime.MIN is +18 ZoneOffset. When trying to deserialize the value without providing this timezone, Jackson uses UTC, which cannot be represented in the java standard library. To solve this issue, you always need to provide the timezone when deserializing. An alternative is to configure the serializer to output timestamps as strings in ISO-8601 format instead of epoch seconds. ObjectMapper mapper = new ObjectMapper()
.registerModule(new JavaTimeModule())
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS); |
Awesome, thank you for digging into this @FabianBesner2020! I honestly failed figuring out possible solution, but your guidance would definitely be helpful for me or anyone trying to fix this issue. |
Fixed via #325 by @JooHyukKim -- will be in 2.18.2. |
jdk-17.0.6,
code:
pom:
output:
The text was updated successfully, but these errors were encountered: