-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow strict LocalDate
parsing
#148
Comments
Sounds reasonable, thank you for suggesting this! |
LocalDate
parsing
I'd like to work on this! |
@samwill sounds good to me -- PR can be made against The best first step is probably adding a new unit test that shows the problem: I can actually merge that separately, even before/without fix. The only thing to note is that test should go under package that ends with |
Added a PR with a failing test. I think I know how to fix it now; given no hiccups I should have a fix PR tonight or tomorrow morning 🤞 |
…rmat Test for strict localdate jsonformat #148
…ateTimeFormatter with ResolverStyle.STRICT when JsonFormat lenient = false
@samwill Thank you again for the fix! Will be released in 2.11.0. |
Per default
LocalDateDeserializer
deserializes local dates usingDateTimeFormatter.ISO_LOCAL_DATE
formatter. This formatter usesResolverStyle.STRICT
.If I use
@JsonFormat
(i.e.@JsonFormat(pattern = "yyyy-MM-dd", lenient = OptBoolean.FALSE)
) the created DateTimeFormatter usesResolverStyle.SMART
. It accepts invalid dates like2019-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 useResolverStyle.STRICT
if the lenient attribute is set tofalse
.The text was updated successfully, but these errors were encountered: