Skip to content

Allow use of StdDateFormat.setLenient() #803

@raj-ghodke

Description

@raj-ghodke

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions