Skip to content
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

Editorial: Adapt to ECMA-262 DefaultTimeZone #721

Merged
merged 3 commits into from
Nov 3, 2022

Conversation

ptomato
Copy link
Contributor

@ptomato ptomato commented Oct 10, 2022

This makes some editorial changes as a result of tc39/ecma262#2781:

  • ECMA-262 now has its own DefaultTimeZone operation, so ECMA-402 should note that it supersedes the ECMA-262 one.
  • The LocalTZA operation is gone from ECMA-262, so instead use the GetNamedTimeZoneOffsetNanoseconds operation in ToLocalTime.
  • GetNamedTimeZoneOffsetNanoseconds encapsulates the requirement to use best-available time zone information, so we can remove one instance of that language and simplify ToLocalTime by calculating the local time regardless of calendar.
  • Add structured headers to DefaultTimeZone and ToLocalTime while we're at it.

Closes: #684

Now that ECMA-262 has gained DefaultTimeZone, note that the definition in
this specification supersedes the other one.

Add a structured header while we are at it.
The operation LocalTZA from ECMA-262 has been replaced by other, more
clearly specified, mechanisms for determining the time zone offset.

(The language "LocalTZA() where the local time zone is replaced with
_timeZone_" seemed insufficiently specific, anyway.)

This uses the new operation GetNamedTimeZoneOffsetNanoseconds from
ECMA-262 to calculate the time zone offset. This operation encapsulates
the requirement to "use best available information about the specified
time zone, including current and historical information about time zone
offsets from UTC and daylight saving time rules," so we can delete that
text from the non-Gregorian branch in this operation.

Add a structured header while we're at it.

In addition, I believe the types of _t_ and _tz_ were backwards. _t_ is an
exact time in milliseconds, so it is a time value. Elsewhere we ensure _t_
is not NaN, so we can say it is a finite time value. _tz_ may not be a
time value once _offsetMs_ (formerly _timeZoneOffset_) is added to it, so
it is an integral Number.
@ptomato ptomato changed the title Adapt to ECMA-262 DefaultTimeZone Editorial: Adapt to ECMA-262 DefaultTimeZone Oct 10, 2022
@ptomato
Copy link
Contributor Author

ptomato commented Oct 11, 2022

@Ms2ger suggested I add a third commit that changes ToLocalTime to use epoch nanoseconds, which is similar to a change that we have in Temporal. This is also an editorial change and I think there's an advantage to bringing it in now.

spec/datetimeformat.html Outdated Show resolved Hide resolved
spec/datetimeformat.html Outdated Show resolved Hide resolved
This is an optional third commit that changes ToLocalTime to use epoch
nanoseconds instead of milliseconds, in anticipation of Temporal becoming
part of the specification. However, there is a small advantage to bringing
this change in now, because using epoch nanoseconds fits better with the
adaptation to use GetNamedTimeZoneOffsetNanoseconds from the previous
commit, which also takes epoch nanoseconds.

I've taken the liberty of changing the "Operation(x) specified in es2023's
Operation" language to just use the automatic linking through the
ecma262 bibliography.
@ryzokuken ryzokuken merged commit b3f9a1b into tc39:master Nov 3, 2022
@ptomato ptomato deleted the adapt-to-ecma262-defaulttimezone branch November 3, 2022 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changes to LocalTZA and DefaultTimeZone in ECMA-262
3 participants