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
Is your feature request related to a problem? Please describe.
I recently ran across a bug in code I was working on that was due to the client code passing across a date/time value for a different time zone than the server into a LocalDate property. Due to this, the date portion of the string was a different date than was intended. This would have been prevented had the backend code rejected the date/time value, and only accepted a value in yyyy-MM-dd format. I can configure that for each individual property using @JsonFormat(pattern = "yyyy-MM-dd"), but I would rather be able to configure something like this globally.
Describe the solution you'd like
I would like a feature that could be configured on ObjectMapper that causes a date with temporal information to be rejected when deserializing to a LocalDate. Two ways I could see this being done are by globally specifying the exact format to use (yyyy-MM-dd), or by having some sort of global flag telling Jackson to be strict about date formats that contain extra temporal information.
Here are some related Stack Overflow questions regarding this same situation:
"or by having some sort of global flag telling Jackson to be strict about date formats that contain extra temporal information."
I believe this was recently fixed, in 2.13, see Java 8 issue 212:
Currently LocalDateDeserializer automatically accepts non-standard format where time part also exists.
While this is useful for some use cases, compatibility, it seems reasonable that if user forces "strict" handling (via @jsonformat, or global default), that part would not be accepted.
Is your feature request related to a problem? Please describe.
I recently ran across a bug in code I was working on that was due to the client code passing across a date/time value for a different time zone than the server into a
LocalDate
property. Due to this, the date portion of the string was a different date than was intended. This would have been prevented had the backend code rejected the date/time value, and only accepted a value inyyyy-MM-dd
format. I can configure that for each individual property using@JsonFormat(pattern = "yyyy-MM-dd")
, but I would rather be able to configure something like this globally.Describe the solution you'd like
I would like a feature that could be configured on
ObjectMapper
that causes a date with temporal information to be rejected when deserializing to aLocalDate
. Two ways I could see this being done are by globally specifying the exact format to use (yyyy-MM-dd
), or by having some sort of global flag telling Jackson to be strict about date formats that contain extra temporal information.Here are some related Stack Overflow questions regarding this same situation:
The text was updated successfully, but these errors were encountered: