-
Notifications
You must be signed in to change notification settings - Fork 143
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
Clarify timeStyle:long/full for Plain types #2795
Comments
This is a shortcoming in the reference code, I think. Time zone should never be printed for Plain types. But I can't remember off the top of my head if the spec says to throw in that case, or to ignore the |
I looked at the spec and I believe it should be ignored. In step 57 of CreateDateTimeFormat we consult Table 27 to see which options are supported for each Temporal type, and only copy supported options from formatOptions to limitedOptions for use in determining the DTF pattern for that Temporal type. |
Thanks for the info @ptomato. The algorithm you describe for copying DateTimeFormat options makes sense. The problem I'm posing is actually not very related to The crux of the problem is related to Temporal.Now.plainDateTimeISO().toLocaleString('en', {
timeStyle: 'full',
})
// "3:14:26 PM Eastern Standard Time" for me This is a shortcoming with the reference implementation specifically. The |
Yes, please feel free! The reference polyfill already uses plenty of other workarounds in |
Got it, thanks @ptomato. Then I assume this is a mistake in this test: The That test is currently being ignored but I can make a fix so that when it comes back online it won't cause problems. |
It's not obvious to me that there's a desired behaviour that will meet everyone's expectations all the time. But reading the spec I agree that |
Hello!
All the Plain* types accept timeZoneName/timeZone for their
toLocaleString
string methods but they're ignored:However, when
timeStyle
is set to either'full'
or'long'
, the time zone is included:I this intentional? Or just a shortcoming of the reference polyfill?
If it is in fact a shortcoming, and the reference polyfill should not be doing this, I would recommend internally forcing
timeStyle
'full'
or'long'
to'medium'
to omit the timeZone.I've tested to see whether the 'medium' is always simply the 'long' or 'full' minus the timezone, and it seems to be the case:
https://codepen.io/arshaw/pen/MWRYKqV?editors=0010
This technique doesn't work for Dzongkha/Esperanto in Firefox/Safari, but still probably okay to force it 'medium' for those locales nonetheless.
I'm happy to create a PR for this if applicable.
The text was updated successfully, but these errors were encountered: