-
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
ObjectMapper#setTimeZone ignored by jsr-310/datetime types during serialization when using @JsonFormat
annotation
#175
Comments
Sounds like a bug, thank you for reporting this. |
yes, i used the last version : implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.11.0' |
Looking at Joda ( But this is missing from jsr-310/datetime module, so it would need to be added. @kupci Not sure if this is something you are aware of. |
But this is missing from jsr-310/datetime module, so it would need to be added. |
…e types during serialization
…e types during serialization
@JsonFormat
annotation
Hello, i have an issue regarding the serialization of OffsetDateTime, the timezone i set in the object mapper is not used
With the following code
I'm expecting that the output is
{"offsetDateTimeWithoutTimeZone" : "2020-06-01T14:00:00.000+02:00"}
but i get
{"offsetDateTimeWithoutTimeZone" : "2020-06-01T12:00:00.000Z"}
The javadoc of com.fasterxml.jackson.annotation.JsonFormat#timezone tells me that the default is the one specified in the objectMapper, but UTC is used instead.
I search a bit in the code, and i didn't see anything regarding the use of ObjectMapper#setTimezone in the method com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase#createContextual
When i specify the timezone in the JsonFormat annotation, it work as intended, but i would prefer to have a global setting rather specifying it for each field.
I created a repo with a working code to illustrate my question : https://github.com/ErwanLeroux/jackson-issue
The text was updated successfully, but these errors were encountered: