`StdDateFormat` deserializes dates with no tz/offset as UTC instead of configured timezone
See original GitHub issuePrior to version 2.8.9
, dates without time zone or time offset (eg 1970-01-01T00:00:00.000
) were deserialised in the TimeZone set on the ObjectMapper.
Starting from 2.8.9
, these dates are deserialised in UTC
- which is a major (breaking) change in behaviour…
Example:
ObjectMapper mapper = new ObjectMapper();
mapper.setTimeZone(TimeZone.getTimeZone("GMT+2");
Date date = mapper.readValue("\"1970-01-01T00:00:00.000\"", java.util.Date.class);
// date == "1970-01-01T00:00:00.000+02.00" with Jackson < 2.8.9
// date == "1970-01-01T00:00:00.000+00.00" with Jackson 2.8.9
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
`StdDateFormat` deserializes dates with no tz/offset as UTC ...
9 , dates without time zone or time offset (eg 1970-01-01T00:00:00.000 ) were deserialised in the TimeZone set on the ObjectMapper. Starting ...
Read more >StdDateFormat (jackson-databind 2.13.0 API) - FasterXML
Method used for creating a new instance with specified timezone; if no timezone specified, defaults to the default timezone (UTC). Methods inherited from...
Read more >java - Jackson OffsetDateTime serialization Z instead of +00 ...
Is there something I'm missing or doing wrong here, or anyway I can get the timezone information serialized as the +00:00 format instead...
Read more >Class StdDateFormat
Method used for creating a new instance with specified timezone; if no timezone specified, defaults to the default timezone (UTC).
Read more >DateTimeZoneHandling setting - Json.NET
Flight flight = new Flight { Destination = "Dubai", DepartureDate = new DateTime(2013, 1, 21, 0, 0, 0, DateTimeKind.Unspecified), DepartureDateUtc = new ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cowtowncoder Any chance we could release
2.8.9.1
soon ?@brenuart I could do that relatively soon – I am hoping for a fix or two, for some reason getting lots of reports now. Could do one before leaving for vacation on saturday.