question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ISO8601DateFormat is deprecated but replacement is unclear.

See original GitHub issue

com.fasterxml.jackson.databind.util.ISO8601DateFormat is deprecated since 2.9 but I couldn’t find any information about how to replace its current usage while upgrading.

So far, I checked the following locations:

But no luck…

I suspect that I could probably just delete objectMapper.setDateFormat(new ISO8601DateFormat()); and be fine but I wanted to double-check.

So this is a bug report against the documentation, not the code. If it can be safely removed and dates are still serialized as ISO-8601 strings then this should be mentioned somewhere.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

16reactions
dmitrygusevcommented, Oct 30, 2018

Looks like default StdDateFormat doesn’t format date-time the same as ISO8601DateFormat.

I found this while integrating with a 3rd party API which uses Swagger spec. In Swagger they have a date-time data type:

date-time – the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z

According to the RFC the timezone information must follow this BNF:

   time-numoffset  = ("+" / "-") time-hour ":" time-minute
   time-offset     = "Z" / time-numoffset
...
   full-time       = partial-time time-offset

Notice the ":" in time-numoffset is not optional, but default StdDateFormat is omitting it, so Swagger implementations will refuse such dates.

Not sure if that’s an issue in RFC or Swagger, but I cannot really use the default StdDateFormat. With ISO8601DateFormat everything works as expected, but as I understand the class is deprecated for removal.

11reactions
rferreiracommented, Jan 20, 2018

For posterity, here’s an example of serializing to iso8601 without the ISO8601DateFormat class from the jackson tests themselves: https://github.com/FasterXML/jackson-databind/blob/b1aa8e300519076b2140a2bfd73bf0eac73191de/src/test/java/com/fasterxml/jackson/databind/ser/jdk/DateSerializationTest.java#L118

Read more comments on GitHub >

github_iconTop Results From Across the Web

replacing ISO8601Utils with the external json schema ...
There was a question on GitHub: ISO8601DateFormat is deprecated but replacement is unclear related to your question.
Read more >
ISO8601DateFormat (jackson-databind 2.9.0 API) - FasterXML
@Deprecated public class ISO8601DateFormat extends DateFormat ... All other methods but parse and format and clone are undefined behavior.
Read more >
Why isn't DATE_ISO8601 deprecated? : r/PHP - Reddit
I feel like a date format named ISO8601 that is not compatible with the ISO-8601 standard is a very confusing thing.
Read more >
ISO Date format with Biblatex/Biber? - LaTeX Stack Exchange
Now edtf has been replaced by iso . ... As of biblatex 3.5, iso8601 is deprecated and edtf together with seconds=true should be...
Read more >
ISO 8601 - Wikipedia
In these representations, the [n] is replaced by the value for each of the date and time elements that follow the [n]. Leading...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found