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

Add TZOffset{UTC,Local} in place of LocalTZA/DSTA #771

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -25935,20 +25935,23 @@ <h1>Week Day</h1>
</emu-clause>

<!-- es6num="20.3.1.7" -->
<emu-clause id="sec-local-time-zone-adjustment">
<h1>Local Time Zone Adjustment</h1>
<p>An implementation of ECMAScript is expected to determine the local time zone adjustment. The local time zone adjustment is a value <dfn>LocalTZA</dfn> measured in milliseconds which when added to UTC represents the local <em>standard</em> time. Daylight saving time is <em>not</em> reflected by LocalTZA.</p>
<emu-clause id="sec-time-zone-offset-from-utc">
<h1>Time Zone Offset from UTC</h1>
<p>An implementation of ECMAScript is expected to determine the local time zone offset from UTC TZOffsetUTC(_t_) using the best available information on time zones. The time zone offset from UTC at time represented by time value _t_ (UTC) is a value <dfn>TZOffsetUTC(_t_)</dfn> measured in milliseconds which when subtracted from UTC represents the local time.</p>
<emu-note>
<p>It is recommended that implementations use the time zone information of the IANA Time Zone Database <a href="http://www.iana.org/time-zones/">http://www.iana.org/time-zones/</a>.</p>
</emu-note>
</emu-clause>

<!-- es6num="20.3.1.8" -->
<emu-clause id="sec-daylight-saving-time-adjustment">
<h1>Daylight Saving Time Adjustment</h1>
<p>An implementation dependent algorithm using best available information on time zones to determine the local daylight saving time adjustment DaylightSavingTA(_t_), measured in milliseconds. An implementation of ECMAScript is expected to make its best effort to determine the local daylight saving time adjustment.</p>
<emu-clause id="sec-time-zone-offset-from-localtime">
<h1>Time Zone Offset from LocalTime</h1>
<p>An implementation of ECMAScript is expected to determine the local time zone offset from local time TZOffsetLocal(<emu-eqn>_t_<sub>local</sub></emu-eqn>) using the best available information on time zones. The time zone offset at the local time <emu-eqn>_t_<sub>local</sub></emu-eqn> is a value <dfn>TZOffsetLocal(<emu-eqn>_t_<sub>local</sub></emu-eqn>)</dfn> measured in milliseconds which when added to the local time represents UTC.</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function needs a second, optional parameter, by which to sanitize spring-forward gaps and disambiguate fall-back duplications. Given that you want the default behaviour to be "use the offset that was in effect before the transition", that optional parameter needs to select between before and after; so I suggest it be called prior and default to true; it says whether to use the offset in effect before a transition, when the specified time falls into one; if given and false, it selects the offset in effect after the transition.

<p>When <emu-eqn>_t_<sub>local</sub></emu-eqn> represents wall time repeating multiple times at a positive time zone offset transition (e.g. when the daylight savings time ends or the time zone offset is increased) or skipped wall time at a negative time zone offset transitions (e.g. when the daylight savings time starts or the time zone offset is decreased), <emu-eqn>_t_<sub>local</sub></emu-eqn> should be interpreted with the time zone offset after the transition.</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for "multiple times" - given that "repeating" implicitly says that - and explicitly saying "multiple times" rather than "twice" suggests more than twice, which does never happen and we have no sane way to cope with it if it did.

also: s/the daylight savings time/daylight-saving time/g
... and, at the end, s/after/before/, but description of the argument "prior" should cover this.

<emu-note>
<p>It is recommended that implementations use the time zone information of the IANA Time Zone Database <a href="http://www.iana.org/time-zones/">http://www.iana.org/time-zones/</a>.</p>
<p>1:30 AM on November 5, 2017 in America/New_York is repeated twice (fall backward), but it should be interpreted as 1:30 AM UTC-05 instead of 1:30 AM UTC-04. TZOffsetLocal should be <emu-eqn>+5 &times; msPerHour</emu-eqn>.</p>
<p>2:30 AM on March 12, 2017 in America/New_York does not exist, but it should be interpreted as 2:30 AM UTC-04. TZOffsetLocal should be <emu-eqn>+4 &times; msPerHour</emu-eqn>.</p>.
</emu-note>
</emu-clause>

Expand All @@ -25957,19 +25960,22 @@ <h1>Daylight Saving Time Adjustment</h1>
<h1>LocalTime ( _t_ )</h1>
<p>The abstract operation LocalTime with argument _t_ converts _t_ from UTC to local time by performing the following steps:</p>
<emu-alg>
1. Return _t_ + LocalTZA + DaylightSavingTA(_t_).
1. Return _t_ - TZOffsetUTC(_t_).
</emu-alg>
<emu-note>
<p>Two different time values (_t_ (UTC)) are converted to the same local time <emu-eqn>t<sub>local</sub></emu-eqn> at a positive time zone offset transition when there are repeated times (e.g. the daylight savings time ends or the time zone offset is increased.).</p>
</emu-note>
</emu-clause>

<!-- es6num="20.3.1.10" -->
<emu-clause id="sec-utc-t" aoid="UTC">
<h1>UTC ( _t_ )</h1>
<p>The abstract operation UTC with argument _t_ converts _t_ from local time to UTC. It performs the following steps:</p>
<h1>UTC ( <emu-eqn>_t_<sub>local</sub></emu-eqn> )</h1>
<p>The abstract operation UTC with argument <emu-eqn>_t_<sub>local</sub></emu-eqn> converts <emu-eqn>_t_<sub>local</sub></emu-eqn> from local time to UTC. It performs the following steps:</p>
<emu-alg>
1. Return _t_ - LocalTZA - DaylightSavingTA(_t_ - LocalTZA).
1. Return _t_ + TZOffsetLocal(<emu-eqn>_t_<sub>local</sub></emu-eqn>)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing subscript local on first t.

</emu-alg>
<emu-note>
<p><emu-eqn>UTC(LocalTime(_t_))</emu-eqn> is not necessarily always equal to _t_.</p>
<p><emu-eqn>UTC(LocalTime(_t_))</emu-eqn> is not necessarily always equal to _t_. <emu-eqn>LocalTime(UTC(_t_<sub>local</sub>))</emu-eqn> is not necessarily always equal to <emu-eqn>_t_<sub>local</sub></emu-eqn>, either.</p>
</emu-note>
</emu-clause>

Expand Down