-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider not using Etc/Unknown
time zone
#5653
Comments
We've discussed Etc/Unknown a number of times in the ECMAScript context, but I'm not finding the conclusion of those conversations. I know that @justingrant got more aliases added to 2024b. I thought Factory was part of that but maybe not. As far as time zone display goes, there's a difference between "unk" and None, as you noted, which is whether "Unknown City" is displayed instead of the UTC offset time zone. It is likely desirable if there is no offset available: Unknown City is better than GMT+? when starting from a location format. Maybe this could be handled internally by sticking Unknown City as the final fallback for location-based formats (after trying offset). And, as you also noted, we're doing this because UTS 35 says we should. So this seems like material we maybe should first discuss with them. |
This won't happen under the plans in #5533, as an input with no time zone and no offset won't be possible. I also think it should say something like |
Wait: if we move in the direction of being super strict about fields being present or not in the time zone, as you propose in #5533, then it wouldn't be possible to construct a // Europe/Kyiv was not added until 2022b; it was previously Europe/Kiev.
// Older installations might not know about the updated name yet.
let location_time_zone = TimeZone::<Location>::try_from_str("Europe/Kyiv")
.unwrap_or(TimeZone::<Location>::unknown()); |
I agree with @robertbastian that the current state is bad and annoying for both implementers and end-users. FWIW, the current state in ECMAScript is that when the engine doesn't recognize the OS's time zone, ICU4C returns Etc/Unknown when asked for the system time zone, and at least in Chrome and Safari AFAIK will return Etc/Unknown to the ECMAScript userland caller. But if you try to use Etc/Unknown as input, V8/JSC/SM engines will all throw. Example: new Intl.DateTimeFormat("en", {timeZone: 'Etc/Unknown'})
// => Uncaught RangeError: invalid time zone in DateTimeFormat(): Etc/Unknown I believe that this behavior means that
The conclusion of those previous discussions was that there was no consensus on what to do about it.
What you might be thinking of is a change made in CLDR where Factory is now an alias for Etc/Unknown. So if the system's time zone is Factory, then the latest ICU4C reports the canonical ID as Etc/Unknown. AFAIK, systems with Factory as their time zone are very rare because modern OS's now make time zone setting part of OS installation or IT provisioning. But there was no upstream change in how Factory is handled in IANA. Note that this change wasn't rejected by IANA. I just didn't ask them for any changes. I could ask the IANA TZ list if they'd be willing to add Etc/Unknown, which currently doesn't exist in IANA, and make Factory a Link to Etc/Unknown. Should I do this? Based on how surprisingly easy it was to get them to update those legacy aliases, I think there's a reasonable chance of success with this change in IANA. At least then we'd have a universal name across IANA and CLDR for the "I have no idea what this time zone is" case. But it still leaves the question of how engines (or ICU4X) should handle that unknown time zone case. Should they:
I strongly agree with this. Only people who know about the IANA Time Zone Database will associate cities with time zones. I think "Unknown time zone" is the right English localized name for Etc/Unknown and Factory. |
If the system time zone identifier is unknown, Firefox first checks if there's a |
This seems similar to the behaviour we are discussing in #5533, i.e. if there's no time zone but an offset, we can work with the offset. I feel like the key questions are
It sounds like FF's answer to those is yes and yes, ICU4X's current answer is no and no. @anba if FF fails to find a |
It falls back to UTC offset. (This is for the |
This zone seems to exist in ICU only because they weren't able to make the API return null due to stability concerns: https://sourceforge.net/p/icu/mailman/icu-design/thread/OF8057666A.AF51DAC4-ON8525783C.00236E03-8525783C.00238179%40lotus.com/#msg27085500 We are already returning an |
WG discussion:
IXDTF cases: Parse errors:
Z:
OffsetOnly:
LocationOnly:
Full:
Discussion:
More scratch pad:
Conclusions:
LGTM: @sffc @robertbastian @Manishearth |
To add to my previous comment: I can envision some data that maps an offset to a "primary metazone": all 24+ of the most common offsets have a primary metazone. This requires TZDB since UTC+1 could be either "Western European Summer Time" or "Central European Standard Time". This operation should only be performed if there is no named time zone. I am not necessarily advocating for this, but I am using it as evidence that "offset only" and "offset with time zone unk" are two different concepts. |
I don't think that's correct. UTC+1 could, on the same day (in the northern summer), be Western European Summer Time or West Africa Time; two metazones with different standard offsets that match because one observes DST and the other doesn't. |
I posted my idea in https://unicode-org.atlassian.net/browse/CLDR-18037. |
This is mostly implemented in #5700. We haven't handled the |
The
Etc/Unknown
timezone is not a TZDB timezone. It was invented by CLDR to signal the absence of time zone information, and this is causing confusion when surfaced to users: https://www.google.com/search?q=etc%2Funknown, tc39/proposal-temporal#2510.Using
Etc/Unknown
means that every API that handles a time zone input has to special-case this input, which is easy to miss. A more solid API would useOption<TimeZoneBcp47Id>
withNone
instead ofEtc/Unknown
.Our
TimeZoneMapper
already returnsOption<TimeZoneBcp47Id>
, and our formatter input already usesOption<TimeZoneBcp47Id>
so we effectively have two ways of representing unknown time zones:None
andSome("unk")
. During formatting,None
will fall back to the offset (good), and then to{GMT+?}
(good), whereasSome("unk")
will format asUnknown City Daylight Time
orheure: ville inconnue
under location formats even when there is an offset that could be formatted.1My concrete proposal is:
Etc/Unknown
key (and its alias,Factory
) from the IANA->BCP47 mapping.Etc/Unknown
IANA ID will fail, becauseEtc/Unknown
is not a valid IANA IDFactory
IANA ID will fail because we say so (and document it)unk
key from the BCP47->IANA mappingEtc/Unknown
is not a canonical IANA IDEtc/Unknown
time zone, even when an offset could be formatted.Footnotes
I understand UTS-35 wants it like this, but I don't see why. ↩
The text was updated successfully, but these errors were encountered: