Skip to content

Conversation

ptomato
Copy link
Contributor

@ptomato ptomato commented Feb 7, 2025

Previously, if timeZoneName was given by itself in the formatting options, the default formatting for the other date/time components would be added. This is inconsistent with what we do for dayPeriod where a lone dayPeriod produces formats such as "in the afternoon".

The use case of obtaining the localized time zone name in all its possible variants such as specific/generic, has been mentioned several times.

This change makes a lone timeZoneName be passed to the format matcher algorithm without added date/time components, and requires implementations to have at least a year-month-day-hour-minute-second-timeZoneName format available.

See: #461

Previously, if `timeZoneName` was given by itself in the formatting
options, the default formatting for the other date/time components would
be added. This is inconsistent with what we do for `dayPeriod` where a
lone `dayPeriod` produces formats such as "in the afternoon".

The use case of obtaining the localized time zone name in all its
possible variants such as specific/generic, has been mentioned several
times.

This change makes a lone `timeZoneName` be passed to the format matcher
algorithm without added date/time components, and requires
implementations to have at least a
year-month-day-hour-minute-second-timeZoneName format available.

See: tc39#461
@ptomato
Copy link
Contributor Author

ptomato commented Feb 7, 2025

See #957 for a similar change for era.

@sffc
Copy link
Contributor

sffc commented Jun 9, 2025

I believe that the following code has worked since Intl 1.0, and it seems like a reasonable thing to write:

new Date().toLocaleTimeString("en", { timeZoneName: "long" })
'12:56:33 PM Pacific Daylight Time'

@ptomato
Copy link
Contributor Author

ptomato commented Jun 24, 2025

Yes, it's not unreasonable to write, it's just that it's inconsistent with every other options property.

> new Date().toLocaleString(undefined, { hour: 'numeric' })
'10 a.m.'
> new Date().toLocaleString(undefined, { month: 'long' })
'June'

@sffc
Copy link
Contributor

sffc commented Jun 24, 2025

Yes, I agree that I think this was a questionable design choice. It's only that the bar for changing a feature that has been working for 10 years is high, and "it seems like a reasonable thing to write" is unlikely to meet that bar. It would have to be "this seems extremely unlikely to have happened and here's some data to back that up." 😔

@ptomato
Copy link
Contributor Author

ptomato commented Jun 24, 2025

It's somewhere on my to-do list to investigate if there is such data, but it's not a high priority right now.

@sffc
Copy link
Contributor

sffc commented Jul 17, 2025

TG2 discussion: https://github.com/tc39/ecma402/blob/main/meetings/notes-2025-07-17.md#normative-dont-add-default-formatting-to-lone-timezonename-958

I'm seeking agreement on the following proposed conclusion:

We feel that the proposed behavior is better, but we are skeptical that making this change would not break the web. If we see evidence to the contrary, we can revisit. But, we are confident enough in our skepticism that we intend to close this pull request and explore other avenues for supporting standalone time zone and era formatting, which was the original motivation for the pull request.

@sffc
Copy link
Contributor

sffc commented Aug 15, 2025

@sffc sffc closed this Aug 15, 2025
@sffc sffc moved this from Priority Issues to Previously Discussed in ECMA-402 Meeting Topics Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Previously Discussed
Development

Successfully merging this pull request may close these issues.

3 participants