Loading... (original) (raw)

If a supplemental new era is specified with the system property "jdk.calendar.japanese.supplemental.era", the display name is incorrect in the formatted string. The following code snippet demonstrates the issue (" -Djdk.calendar.japanese.supplemental.era="name=NewEra,abbr=N.E.,since=1546300800000"" is given on invocation):

--
LocalDate ldHeisei = LocalDate.of(2018, Month.JANUARY, 1);
LocalDate ldNewEra = LocalDate.of(2019, Month.JANUARY, 1); // first day of NewEra
DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)
.withChronology(JapaneseChronology.INSTANCE)
.withZone(ZoneId.systemDefault());
System.out.println(dtf.format(ldHeisei));
System.out.println(dtf.format(ldNewEra));
--

The output is:

--
Monday, January 1, 30 Heisei
Tuesday, January 1, 1 3
--

The last "3" should display as "NewEra."