obtain the maximum era with ucal_getLimit in japanese calendar seems ignore the local timezone

Description

obtain the maximum era with ucal_getLimit in japanese calendar seems ignore the local timezone

the new era anticipated to begin on 1 May 2019, this means ucal_getLimit should return the new era type index at 1 May 2019. suppose the code running under the Japanese time zone, the new era will only appear at 2019-05-01 00:00:00 (UTC) Instead of 2019-05-01 00:00:00 (JST). this means the new era will not take effect until 9:00(AM) Japan time.

The following code can reproduce this issue:

Associated: Fix Getting Max Japanese Era

Activity

Show:
Jeff Genovy
March 13, 2019, 7:55 AM

I suspect the issue is because the API ucal_getLimit eventually uses the API ucal_getNow to determine the “current” time, which according to the documentation:

Returns the current UTC (GMT) time measured in milliseconds since 0:00:00 on 1/1/70 (derived from the system time).

Link to code: https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/erarules.cpp#L292

I wonder if perhaps this code in erarules.cpp could be changed to get the current time using ICU’s default time zone instead?

Jeff Genovy
March 16, 2019, 9:29 PM

Hello and ,

I pushed some changes to a branch in my fork to modify the Japanese Calendar current era calculation so that it uses the default ICU time zone instead of using UTC.

Link:
https://github.com/unicode-org/icu/compare/master...jefgen:jefgen/ICU-20475-current-JaEra-local-timezone

However, this is only for ICU4C. If this seems okay, then could somebody help me with the similar change on the ICU4J implementation?

Thank you!

Jeff Genovy
April 3, 2019, 4:59 PM

ICU4C: https://github.com/unicode-org/icu/pull/574
ICU4J: https://github.com/unicode-org/icu/pull/575

This should likely go into the 64.2 version.

Jeff Genovy
April 9, 2019, 1:31 AM

I'm stealing this ticket from you and assigning to me.

Jeff Genovy
April 9, 2019, 1:32 AM
Fixed

Assignee

Jeff Genovy

Reporter

EchoFan

Components

Labels

Reviewer

Yoshito Umaoka

Priority

major

Time Needed

None

Fix versions

Configure