On Thu, Apr 30, 2020 at 9:53 AM Martin Lichtin <[email protected]> wrote: > > In StdDateFormat there's this comment > > // 24-Jun-2017, tatu: While `Z` would be conveniently short, > older specs > // mandate use of full `+0000` > // formatted.append('Z'); > > Wanted to ask if and why this is still relevant, as it seems to me it would > be more natural to serialize using 'Z'. > Or perhaps offer a flag to control this as a serialization option.
Yes, ideally `Z` would (have been) used already. Challenge is mostly about backwards compatibility: switch from "+0000" to "+00:00" happens in 2.11; 3.x (`master`) would produce `Z`. Beyond this while adding a configuration feature would be an option it seems like a "too small" (or too datatype-specific) option to go as either `DeserializationFeature` or `MapperFeature` (granted some existing settings already go to minutiae). Instead, `@JsonFormat` could work better, but this particular setting is not really generic enough to work well there. Beyond this, there are questions on uniformity (and lack thereof) between date/time types: this code is only used for `java.util.Date` / `Calendar`, and most new code uses (and definitely should use) Joda date/time or Java 8 date/time values. Their defaults are different. On plus side this is a known problem area at least. One possibility would be to perhaps create a new configuration type (`DateTimeConfig`), configurable on `ObjectMapper`. This is what I had in mind for JSTEP-5: https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-5 but have not had time to refine my thoughts (nor gotten much feedback). Looking at various discussion on date/time, what I do know is that I don't know enough of date/time handling (and that Internet is full of people who do, or at least think, they know much more :-D ) -+ Tatu +- -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/CAL4a10j15TDhLCRpe6z6ZJhL6JZFYhHaCBf6s6NhMuVNwfq6vA%40mail.gmail.com.
