Change default textual serialization of `java.util.Date`/`Calendar` to include colon in timezone offset
See original GitHub issue(for background, see #1624 and #1744)
So. While older JDK versions (up to JDK 7) always wrote timezone offset, if any, without colon, like:
+0000
ISO-8601 specification expects minute/hour part to be separated by a colon like
+00:00
While #1744 added an option to enable this behavior, it has not been default for Jackson. Let’s change it in 2.11.
A note on implementation: a new SerializationFeature
setting was briefly considered, but wiring of such setting to be used proved difficult. Users can still use method in StdDateFormat
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Java SimpleDateFormat for time zone with a colon separator?
time classes use ISO 8601 formats by default when parsing/generating textual representations of date-time values. So no need to define a formatting pattern....
Read more >StdDateFormat (jackson-databind 2.13.0 API) - FasterXML
Accessor for checking whether this instance would include colon within timezone serialization or not: if {code true}, timezone offset is serialized like -06:00 ......
Read more >SUSE-SU-2022:1678-1: important: Security update for jackson ...
... argument + Change default textual serialization of 'java.util.Date'/'Calendar' to include colon in timezone offset + Add 'ObjectMapper.
Read more >Time Zone and Offset Classes (The Java™ Tutorials > Date ...
This date-time Java tutorial describes how to use the java.time APIs introduced in JDK ... ZoneOffset specifies a time zone offset from Greenwich/UTC...
Read more >Groovy Language Documentation
Text literals are represented in the form of chain of characters called strings. Groovy lets you instantiate java.lang.String objects, as well as GStrings ......
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
This isn’t clearly documented at all, but after digging through the source code I figured out what you need to do to go back to the old behavior:
Hope that helps someone else. It’s really difficult to get to these everywhere in your code (and shared libraries!) that it might exist. It also means that doing dependency alignment for things like security reasons (e.g. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-28491 ) is extremely difficult.
Thank you for sharing this @jocull. Configurability of date/time handling is quite problematic, alas, both because of variety of differences across platforms and because Java has a few alternatives (“old” JDK, newer Java 8, Joda). And date/time handling is a huge swamp in and of itself, as a domain.
This is known as a problem domain so there have been plans:
https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-5
to try to address settings, defaults, configurability. Currently no one has time to tackle this one, unfortunately.