[tz] OpenJDK/CLDR/ICU/Joda issues with Ireland change

Yoshito Umaoka yoshito_umaoka at us.ibm.com
Sat Jan 27 00:10:43 UTC 2018


> > The new version v2018c is only good for OpenJDK when handling Ireland 
> > now in year 2018. 
> 
> Yes, this is a known issue with CLDR, discussed here:
> 
> https://urldefense.proofpoint.com/v2/url?
> 
u=https-3A__mm.icann.org_pipermail_tz_2018-2DJanuary_025974.html&d=DwICaQ&c=jf_iaSHvJObTbx-
> 
siA1ZOg&r=sE8ucIDOUlZUTL1mVdiOnoXkknyh5kabG5yfwpgfi10&m=RgeB4ArWFe2W4Qo489WjPusbCh0yqUEkcYac204zDSA&s=m9GGwtksBqM_tnPSgu6QD8CC5eLjL_2JUUDfJc-
> IlFA&e=
> 
> which says that CLDR doesn't worry about timestamps before 1990.
> 

Well, above statement is not accurate.
CLDR does not provide any zone names only used before 1990.
If name is not available, CLDR specification (LDML) suggests CLDR data 
consumers to use UTC offset format as the fallback.

So, program utilizing CLDR data should still produce accurate timestamp, 
but just not using zone name.

OpenJDK situation is slightly different. Basically, OpenJDK retrofit CLDR 
data partially and use the set of current names only. As far as I know, 
JDK does not support multiple sets of names for a single tz database zone.

For example, America/Indiana/Knox:

====
# Zone  NAME            GMTOFF  RULES   FORMAT  [UNTIL]
Zone America/Indiana/Knox -5:46:30 -    LMT     1883 Nov 18 12:13:30
                        -6:00   US      C%sT    1947
                        -6:00   Starke  C%sT    1962 Apr 29  2:00
                        -5:00   -       EST     1963 Oct 27  2:00
                        -6:00   US      C%sT    1991 Oct 27  2:00
                        -5:00   -       EST     2006 Apr  2  2:00
                        -6:00   US      C%sT
====

With Java, formatting date on Jan 1 2000 and 2010, format date should be 
in EST, while latter date is in CST. However, my understanding is that 
Java only use the current name set (in this case, US Central Time), Java 
date formatter prints out "Central Standard Time" for both date.


Example 1 (TimeZone and DateFormat):

    TimeZone tzKnox = TimeZone.getTimeZone("America/Indiana/Knox");
    GregorianCalendar cal = new GregorianCalendar();
    cal.setTimeZone(tzKnox);

    DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.FULL, 
DateFormat.FULL, Locale.US);
    fmt.setTimeZone(tzKnox);

    cal.clear();
    cal.set(2000, Calendar.JANUARY, 1);
    String dstr2000 = fmt.format(cal.getTime());

    cal.set(2010, Calendar.JANUARY, 1);
    String dstr2010 = fmt.format(cal.getTime());

    System.out.println(dstr2000);
    System.out.println(dstr2010);

Example 2 (java.time):

    ZoneId tzKnox = ZoneId.of("America/Indiana/Knox");
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEEE, MMMM 
d, y 'at' h:mm:ss a zzzz").withZone(tzKnox);

    ZonedDateTime d2000 = ZonedDateTime.of(2000, 1, 1, 0, 0, 0, 0, 
tzKnox);
    String dstr2000 = d2000.format(formatter);

    ZonedDateTime d2010 = ZonedDateTime.of(2010, 1, 1, 0, 0, 0, 0, 
tzKnox);
    String dstr2010 = d2010.format(formatter);

    System.out.println(dstr2000);
    System.out.println(dstr2010);

Both example prints out:

    Saturday, January 1, 2000 at 12:00:00 AM Central Standard Time
    Friday, January 1, 2010 at 12:00:00 AM Central Standard Time

Although, the date on Jan 1, 2000 should be

    Saturday, January 1, 2000 at 12:00:00 AM Eastern Standard Time


-Yoshito




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20180126/696b4d9a/attachment.htm>


More information about the tz mailing list