<i18n dev> The first year skipped when using UTC time for "jdk.calendar.sypplemental.era" system property
Naoto Sato
naoto.sato at oracle.com
Thu Jun 22 23:38:43 UTC 2017
Hi Matsushita-san,
I will look into it. Could you please file an issue about this?
Naoto
On 6/22/17 6:20 PM, Mitsuru Matsushima wrote:
> 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
>
More information about the i18n-dev
mailing list