mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8171049: Era.getDisplayName doesn't work with non-IsoChronology
Reviewed-by: rriggs
This commit is contained in:
parent
496b798b66
commit
b474897fe2
5 changed files with 203 additions and 2 deletions
|
@ -73,6 +73,7 @@ import java.io.ObjectStreamException;
|
|||
import java.io.Serializable;
|
||||
import java.time.DateTimeException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.time.format.TextStyle;
|
||||
import java.time.temporal.ChronoField;
|
||||
import java.time.temporal.TemporalField;
|
||||
|
@ -253,7 +254,12 @@ public final class JapaneseEra
|
|||
Objects.requireNonNull(locale, "locale");
|
||||
return style.asNormal() == TextStyle.NARROW ? getAbbreviation() : getName();
|
||||
}
|
||||
return Era.super.getDisplayName(style, locale);
|
||||
|
||||
return new DateTimeFormatterBuilder()
|
||||
.appendText(ERA, style)
|
||||
.toFormatter(locale)
|
||||
.withChronology(JapaneseChronology.INSTANCE)
|
||||
.format(this == MEIJI ? MEIJI_6_ISODATE : since);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue