-
Notifications
You must be signed in to change notification settings - Fork 124
Closed
Labels
good first issueIssue that seems easy to resolve and is likely a good candidate for contributors new to projectIssue that seems easy to resolve and is likely a good candidate for contributors new to project
Description
Per default LocalDateDeserializer deserializes local dates using DateTimeFormatter.ISO_LOCAL_DATE formatter. This formatter uses ResolverStyle.STRICT.
/**
* Style to resolve dates and times strictly.
* <p>
* Using strict resolution will ensure that all parsed values are within
* the outer range of valid values for the field. Individual fields may
* be further processed for strictness.
* <p>
* For example, resolving year-month and day-of-month in the ISO calendar
* system using strict mode will ensure that the day-of-month is valid
* for the year-month, rejecting invalid values.
*/
STRICT,
If I use @JsonFormat (i.e. @JsonFormat(pattern = "yyyy-MM-dd", lenient = OptBoolean.FALSE)) the created DateTimeFormatter uses ResolverStyle.SMART. It accepts invalid dates like 2019-11-31.
The default formatter does not accept such dates and throws an error.
To make the behaviour consistent, I suggest setting the DateTimeFormatter to use ResolverStyle.STRICT if the lenient attribute is set to false.
kupci
Metadata
Metadata
Assignees
Labels
good first issueIssue that seems easy to resolve and is likely a good candidate for contributors new to projectIssue that seems easy to resolve and is likely a good candidate for contributors new to project