Hi,
I found an issue about "jdk.calendar.sypplemental.era" system property.
According toJavadoc of JapaneseImperialCalendar, the system property can
specify "since" parameter as UTC time.
However, on using UTC time, the first year of new era is skipped.
The new era start with a second year as follow:
NewEra2年1月1日 12:0:0.0
平成30年12月31日 11:59:59.999999999
TEST CODE:
=======================================
public static void main(String... args) {
// set supplemental era
final long since = ZonedDateTime
.of(2019, 1, 1, 0, 0, 0, 0, ZoneId.of("Asia/Tokyo"))
.toInstant().toEpochMilli();
System.setProperty(
"jdk.calendar.japanese.supplemental.era",
"name=NewEra,abbr=N.E,since=" + since + "u");
final DateTimeFormatter fmtrFull =
DateTimeFormatter.ofPattern("GGGGy年M月d日 h:m:s.n")
.withChronology(JapaneseChronology.INSTANCE)
.withLocale(new Locale("ja", "JP", "JP"));
IntStream.rangeClosed(0, 1)
.mapToObj(h -> LocalDateTime.of(2019, 1, 1, 0, 0).minusNanos(h))
.map(fmtrFull::format)
.forEach(System.out::println);
}
=======================================
TEST ENVIRONMENT:
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+174)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+174, mixed mode)
---
Mitsuru