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
{{ message }}
Repository navigation
@DateTimeFormat support for YearMonth, MonthDay, Year [SPR-14839] #19405
I hope to support the @DateTimeFormat annotation for Joda-Time's YearMonth, MonthDay, and Year types, analogous to the existing support for the corresponding JSR-310 types.
Indeed but that ticket just covered parsing according to the default format, like we do for Period and Duration, without any declarative customization options. This ticket is about considering @DateTimeFormat custom pattern support for remaining types where this makes sense.
Also, any reason why this PR doesn't cover for java.time.Month with it's value not as an enum?
// for numeric value@NotNull@DateTimeFormat(pattern = "M") @PathVariable(name = PATH_NAME_MONTH) finalMonthmonth
Failed to convert value of type 'java.lang.String' to required type 'java.time.Month';
nested exception is org.springframework.core.convert.ConversionFailedException:
Failed to convert from type [java.lang.String] to type [@javax.validation.constraints.NotNull @org.springfr
amework.format.annotation.DateTimeFormat @org.springframework.web.bind.annotation.PathVariable java.time.Month] for value '11'; nested exception is java.lang.IllegalArgumentException: No enum constant java.time.Month.11]
Activity
spring-projects-issues commentedon Oct 22, 2016
Kazuki Shimizu commented
I've submitted PR. Please review.
spring-projects-issues commentedon Mar 12, 2018
Sam Brannen commented
Note that the PR currently does not include a
YearFormatter.spring-projects-issues commentedon Mar 12, 2018
Juergen Hoeller commented
Indeed, I'm repurposing this ticket a bit: primarily for JSR-310 where
Yearis also a topic, with Joda-Time as a secondary target.spring-projects-issues commentedon Mar 12, 2018
Sam Brannen commented
But... you just introduced
org.springframework.format.datetime.standard.YearFormatterin Spring 5.0.4 -- right? ;-)spring-projects-issues commentedon Mar 12, 2018
Juergen Hoeller commented
Indeed but that ticket just covered parsing according to the default format, like we do for
PeriodandDuration, without any declarative customization options. This ticket is about considering@DateTimeFormatcustom pattern support for remaining types where this makes sense.spring-projects-issues commentedon Mar 12, 2018
Sam Brannen commented
Indeed!
Thanks for pointing out the difference.
ioxua commentedon Apr 1, 2020
Any reason this issue is frozen?
onacit commentedon Jan 24, 2021
Also, any reason why this PR doesn't cover for
java.time.Monthwith it'svaluenot as anenum?snicoll commentedon Nov 24, 2021
Closing in favor of PR #1215