[tz] Java & Rearguard

Stephen Colebourne scolebourne at joda.org
Wed Jun 5 10:51:25 UTC 2019


On Tue, 4 Jun 2019 at 17:49, Steve Summit <scs at eskimo.com> wrote:
> So the analogous question for me is, "What are Java programs
> using isDaylightSavings for?  What problems would it cause them
> if isDaylightSavings's output changed, or if it disappeared?
> Would some other differently-defined function serve the needs
> of those programs better?"

As discussed when the issue started a couple of years ago, the flag is
used to select the name to display:

 public String getDisplayName(boolean daylight, int style, Locale locale)
 https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/TimeZone.html#getDisplayName(boolean,int,java.util.Locale)

The assumption is that daylight=summer/advanced, and this goes a long
way down the stack, notably into CLDR.

No one in Java-land is saying this API is perfect. Its absoluely clear
that a single boolean is insufficient to lookup a name accurately in
cases like Ramadan. But it has been this way for 20+ years and isn't
going to change any time soon. It also produces an answer that as
correct as the underlying data (CLDR) where there are only "standard"
and "daylight" names. Note that CLDR treats "standard" as winter and
"daylight" as summer/advanced universally.
https://www.unicode.org/reports/tr35/tr35-dates.html#Time_Zone_Names
https://www.unicode.org/cldr/charts/35/verify/zones/en.html

Remember that the offsets from UTC in Java are always right, and this
covers the vast majority of use cases for time-zones. A much smaller
percentage of end-users care about the name of the time-zone, ie. the
difference between Irish Time (all year round), IST or Irish Summer
Time (summer), and GMT or Greenwich Mean Time (winter). But what those
people care about is that the text "Irish Summer Time" is returned in
summer. When tzdb changed its format, end-users started getting "Irish
Summer Time" in winter, because the boolean flag had been reversed -
thats why rearguard or a parser hack has to be used to keep the
boolean flag as daylight=summer.

What almost no end-user cares about is what Irish legislation says
(and I don't think Java should expose that knowledge). As a downstream
consumer, I don't care what the legal status of a period is - I care
whether it is winter or summer/advanced so I can lookup the name in
CLDR.

Stephen



More information about the tz mailing list