-
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
LocalDateDeserializer ignores local time zone #55
Comments
I am not sure why you think local timezone should be used for anything -- Jackson does not use it for anything by default, due to fundamental fragility of relying on something that essentially varies arbitrarily. Instead, default timezone is UTC. Further, https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html So, I do not see behaviour here as wrong -- especially since use of |
Thank you for your time and your explanation. I assumed LocalDate represents a date in the local time zone and not a date without time zone. |
@pherklotz Yes, I can see how name would imply that. Naming is hard, and I am not quite sure why Java 8 name was chosen this way. |
@cowtowncoder The local timezone may not be important, but take this case: |
@dariotortola I think the issue you mention might be fixed/addressed with #94 |
@kupci I'm afraid not - the scenario described by dariotortola is not handled by #94 - I just updated jackson to newest version in the hope it would be, but the fix of #94 is:
So this basically means: cut off the Z and parse it as "2020-04-29T22:00:00.000". Also if this string should be parsed as LocalDate (without Time) the code goes like this with the same result:
So long story short: I think you must tell your client somehow not to convert the "2020-04-30" into a "2020-04-29T22:00:00.000Z" when sending it to the server. If I am mistaken somewhere and there actually is a way to configure jackson to make a "2020-04-29T22:00:00Z" into "200-04-30"-LocalDate, please tell me! It would be very helpful! |
I expect the LocalDateDeserializer to return a date in the local time zone.
Following snippet can reproduce the wrong behaviour.
IMHO should this code executed in GMT+1 print "2018-01-01".
This could be easily fixed. Replace this line:
The text was updated successfully, but these errors were encountered: