You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ObjectMapper uses the StdDateFormat for date serialization. Jackson date parsing is lenient by default, so 2015-01-32 gets parsed as 2015-02-01. Jackson’s StdDateParser is matching default behavior of DateParser.
StdDateParser wasn’t really designed for extension to just enable strict date parsing. If it were, we could just call objectMapper.setDateFormat(new StdDateFormat().setLenient(false)). But StdDateFomrat doesn't support setting lenient to false. And i.e. the reason date like 2015-01-32 gets parsed as 2015-02-01 ad Jackson date parsing is lenient by defualt.
Can StdDateFormat can be enhanced to support to non lenient date parsing?
The text was updated successfully, but these errors were encountered:
Was about to comment that setLenient() exists from the base class but then realized that while true, that will not have an effect on DateFormat instances that are actually used.
So: it should be possible to support non-leniency setting. I can not change setLenient to be chainable (non-covariant change is illegal I think), but it could be changed to pass setting to contained format instances.
cowtowncoder
changed the title
lenient date parsing in StdDateFormat. No support for non lenient date parsing. Can't call stdDateFomrat.setLenient(false)
Allow use of StdDateFormat.setLenient()Dec 23, 2015
ObjectMapper uses the StdDateFormat for date serialization. Jackson date parsing is lenient by default, so 2015-01-32 gets parsed as 2015-02-01. Jackson’s StdDateParser is matching default behavior of DateParser.
StdDateParser wasn’t really designed for extension to just enable strict date parsing. If it were, we could just call objectMapper.setDateFormat(new StdDateFormat().setLenient(false)). But StdDateFomrat doesn't support setting lenient to false. And i.e. the reason date like 2015-01-32 gets parsed as 2015-02-01 ad Jackson date parsing is lenient by defualt.
Can StdDateFormat can be enhanced to support to non lenient date parsing?
The text was updated successfully, but these errors were encountered: