-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editorial: Redefine time zone handling in legacy Date in terms of Def…
…aultTimeZone The intention of this change is to ensure that it is impossible for Temporal to support a different set of time zones than legacy Date. Technically, legacy Date doesn't "support" any time zones — its data model is the same as Temporal.Instant — but calls like new Date(y, m, d, ...) interpret the given date and time as a local time in the system's current time zone. We need to ensure that this vaguely defined "current time zone" is conceptually the same time zone that Temporal.Now.timeZone() returns. Legacy Date's conversion to and from local times is handled by the LocalTZA abstract operation, which is implementation-defined. The idea here is to push the "implementation-definedness" from LocalTZA on to other abstract operations that are also used by Temporal. We remove LocalTZA everywhere it is used, and instead redefine the UTC, LocalTime, and TimeZoneString abstract operations to get the current time zone from the operation DefaultTimeZone, which is where Temporal gets it as well. We also rewrite these operations to perform the same steps as Temporal when it does the same conversions, only without any observable calls to methods on the Temporal.TimeZone object, and without a disambiguation parameter. (The algorithm is the same as what happens when the disambiguation is set to "compatible", which is the default for reasons of interoperability with legacy Date.) This pushes the "implementation-definedness" from LocalTZA into GetIANATimeZoneOffsetNanoseconds, GetIANATimeZoneEpochValue, and DefaultTimeZone. LocalTZA had a lot of explanatory text, which I've tried to move to other sections where it makes sense to do so. (LocalTZA was weird anyway, it performed totally different functions depending on the value of the _isUTC_ parameter — as you can see from the rewritten versions of LocalTime and UTC.) This should affect absolutely nothing for implementations. It's just a more formal guarantee of what was already stipulated. Closes: #519
- Loading branch information
Showing
2 changed files
with
207 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters