-
Notifications
You must be signed in to change notification settings - Fork 156
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
Time zone and DateTime.prototype.toLocaleString #572
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I see the point about opting in. I am strongly in favour of option 2 (doesn't preclude option 3 if we decide so on that issue). Mainly because it's in line with what other types do, in the case where you request information that they don't have: > Temporal.now.time().toLocaleString('en', { month: 'numeric' })
'3:54:52 PM' |
IMHO, the current behavior (1) is not OK to ignore. If DateTime doesn't know about its time zone, then formatting it should not include a timezone. Especially not the wrong timezone! Seems like (2) is the right behavior for a timezone-less class. Nice to see another use-case that'd get easier with a ZonedAbsolute. ;-) Related: #577 |
If the formatting options request a time zone name for any type except Absolute, or a day for YearMonth, or a year for MonthDay, we want to ignore that, since the data model for that type doesn't contain those units. Closes: #572
I've gone ahead and made a pull request for option 2 since I haven't heard any opposition. |
If the formatting options request a time zone name for any type except Absolute, or a day for YearMonth, or a year for MonthDay, we want to ignore that, since the data model for that type doesn't contain those units. Closes: #572
Should we render the time zone if it is specified explicitly?
|
I'd say no, since it could be ambiguous — this was what @justingrant was referring to in #577. |
@sffc Do you feel strongly about rendering the time zone if it is specified explicitly? I think that it should be treated the same as e.g. |
I'm fine with this conclusion. Your reasoning sounds good. |
I think the current semantics are that we use Intl's time zone (the environment time zone) when formatting a DateTime.
However, this could produce unexpected results:
Possible resolutions:
The text was updated successfully, but these errors were encountered: