-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancementA general enhancement
Description
Toshiaki Maki opened SPR-13568 and commented
@DateTimeFormat is really useful. However Japanese Calendar (Wareki) cannot be accepted because there is no way to specify Locale to parse explicitly.
With JDK 1.6, parsing Wareki is as follows:
DateFormat format = new SimpleDateFormat("GGGGyy.MM.dd", new Locale("ja", "JP", "JP"));
format.parse("平成27.10.13"); // -> Tue Oct 13 00:00:00 JST 2015This format is so important in Japan especially in public sectors.
org.springframework.format.datetime.DateFormatter#createDateFormat looks taking Locale object. In my understanding, the locale to be used is decided by the HTTP request and not specified by the application.
I would like to tell the locale by new attribute of @DateTimeFormat.
Supporting Date and Time API looks more difficult because the formatter needs Chronology like following:
DateTimeFormatter.ofPattern("GGGGyy.MM.dd")
.withChronology(JapaneseChronology.INSTANCE)
.parse("平成27.10.13"); // -> {},Japanese resolved to Japanese Heisei 27-10-13Affects: 4.1.7, 4.2.1
Issue Links:
- @DateTimeFormat's JSR-310 formatter is not strict in case of pattern [SPR-13567] #18143
@DateTimeFormat's JSR-310 formatter is not strict in case of pattern
4 votes, 5 watchers
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancementA general enhancement