Skip to content

Commit

Permalink
Editorial: Add indentation in mainadditions.html
Browse files Browse the repository at this point in the history
A later commit will add more Date-related changes, which made it good
to pull in the higher-level "Date Objects" item from the 262 table of
contents. This formatting change required changing indentation of
unchanged spec text which made it harder to review later commits. So
splitting the spacing and TOC changes out into a separate commit here.
  • Loading branch information
justingrant committed Jun 12, 2023
1 parent f487252 commit fc56deb
Showing 1 changed file with 83 additions and 71 deletions.
154 changes: 83 additions & 71 deletions spec/mainadditions.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ <h1>Amendments to the ECMAScript® 2023 Language Specification</h1>
<p>
This section lists amendments which must be made to <a href="https://tc39.es/ecma262/">ECMA-262, the ECMAScript® 2023 Language Specification</a>, other than the addition of the new sections specifying the Temporal object and everything related to it.
Text to be added is marked <ins>like this</ins>, and text to be deleted is marked <del>like this</del>.
Blocks of unmodified text between modified sections are marked by [...].
</p>
</emu-note>

Expand Down Expand Up @@ -212,84 +213,95 @@ <h1>
</emu-clause>
</ins>

<emu-clause id="sec-temporal-date-constructor">
<h1><a href="https://tc39.es/ecma262/#sec-date-constructor">The Date Constructor</a></h1>
<emu-clause id="sec-temporal-date">
<h1><a href="https://tc39.es/ecma262/#sec-date">Date ( ..._values_ )</a></h1>
<p>This function performs the following steps when called:</p>
<emu-alg>
1. <del>If NewTarget is *undefined*, then</del>
1. <del>Let _now_ be the time value (UTC) identifying the current time.</del>
1. <del>Return ToDateString(_now_).</del>
1. <ins>If NewTarget is *undefined*, return ToDateString(SystemUTCEpochMilliseconds()).</ins>
1. Let _numberOfArgs_ be the number of elements in _values_.
1. If _numberOfArgs_ = 0, then
1. Let _dv_ be <del>the time value (UTC) identifying the current time</del> <ins>SystemUTCEpochMilliseconds()</ins>.
1. Else if _numberOfArgs_ = 1, then
1. Let _value_ be _values_[0].
1. If _value_ is an Object and _value_ has a [[DateValue]] internal slot, then
1. Let _tv_ be ! thisTimeValue(_value_).
1. Else,
1. Let _v_ be ? ToPrimitive(_value_).
1. If _v_ is a String, then
1. Assert: The next step never returns an abrupt completion because _v_ is a String.
1. Let _tv_ be the result of parsing _v_ as a date, in exactly the same manner as for the `parse` method (<emu-xref href="#sec-date.parse"></emu-xref>).
<emu-clause id="sec-date-objects">
<h1>Date Objects</h1>
[...]
<emu-clause id="sec-temporal-date-constructor">
<h1><a href="https://tc39.es/ecma262/#sec-date-constructor">The Date Constructor</a></h1>
<emu-clause id="sec-temporal-date">
<h1><a href="https://tc39.es/ecma262/#sec-date">Date ( ..._values_ )</a></h1>
<p>This function performs the following steps when called:</p>
<emu-alg>
1. If NewTarget is *undefined*, then
1. <del>Let _now_ be the time value (UTC) identifying the current time.</del>
1. <ins>Let _global_ be GetGlobalObject().</ins>
1. <ins>Let _nowNs_ be HostSystemUTCEpochNanoseconds(_global_).</ins>
1. <ins>Let _now_ be 𝔽(floor(_nowNs_ / 10<sup>6</sup>)).</ins>
1. Return ToDateString(_now_).
1. Let _numberOfArgs_ be the number of elements in _values_.
1. If _numberOfArgs_ = 0, then
1. <del>Let _dv_ be the time value (UTC) identifying the current time.</del>
1. <ins>Let _global_ be GetGlobalObject().</ins>
1. <ins>Let _nowNs_ be HostSystemUTCEpochNanoseconds(_global_).</ins>
1. <ins>Let _dv_ be 𝔽(floor(_nowNs_ / 10<sup>6</sup>)).</ins>
1. Else if _numberOfArgs_ = 1, then
1. Let _value_ be _values_[0].
1. If _value_ is an Object and _value_ has a [[DateValue]] internal slot, then
1. Let _tv_ be ! thisTimeValue(_value_).
1. Else,
1. Let _tv_ be ? ToNumber(_v_).
1. Let _dv_ be TimeClip(_tv_).
1. Else,
1. Assert: _numberOfArgs_ ≥ 2.
1. Let _y_ be ? ToNumber(_values_[0]).
1. Let _m_ be ? ToNumber(_values_[1]).
1. If _numberOfArgs_ > 2, let _dt_ be ? ToNumber(_values_[2]); else let _dt_ be *1*<sub>𝔽</sub>.
1. If _numberOfArgs_ > 3, let _h_ be ? ToNumber(_values_[3]); else let _h_ be *+0*<sub>𝔽</sub>.
1. If _numberOfArgs_ > 4, let _min_ be ? ToNumber(_values_[4]); else let _min_ be *+0*<sub>𝔽</sub>.
1. If _numberOfArgs_ > 5, let _s_ be ? ToNumber(_values_[5]); else let _s_ be *+0*<sub>𝔽</sub>.
1. If _numberOfArgs_ > 6, let _milli_ be ? ToNumber(_values_[6]); else let _milli_ be *+0*<sub>𝔽</sub>.
1. If _y_ is *NaN*, then
1. Let _yr_ be *NaN*.
1. Let _v_ be ? ToPrimitive(_value_).
1. If _v_ is a String, then
1. Assert: The next step never returns an abrupt completion because _v_ is a String.
1. Let _tv_ be the result of parsing _v_ as a date, in exactly the same manner as for the `parse` method (<emu-xref href="#sec-date.parse"></emu-xref>).
1. Else,
1. Let _tv_ be ? ToNumber(_v_).
1. Let _dv_ be TimeClip(_tv_).
1. Else,
1. Let _yi_ be ! ToIntegerOrInfinity(_y_).
1. If 0 ≤ _yi_ ≤ 99, let _yr_ be *1900*<sub>𝔽</sub> + 𝔽(_yi_); otherwise, let _yr_ be _y_.
1. Let _finalDate_ be MakeDate(MakeDay(_yr_, _m_, _dt_), MakeTime(_h_, _min_, _s_, _milli_)).
1. Let _dv_ be TimeClip(UTC(_finalDate_)).
1. Let _O_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%Date.prototype%"*, « [[DateValue]] »).
1. Set _O_.[[DateValue]] to _dv_.
1. Return _O_.
</emu-alg>
1. Assert: _numberOfArgs_ ≥ 2.
1. Let _y_ be ? ToNumber(_values_[0]).
1. Let _m_ be ? ToNumber(_values_[1]).
1. If _numberOfArgs_ > 2, let _dt_ be ? ToNumber(_values_[2]); else let _dt_ be *1*<sub>𝔽</sub>.
1. If _numberOfArgs_ > 3, let _h_ be ? ToNumber(_values_[3]); else let _h_ be *+0*<sub>𝔽</sub>.
1. If _numberOfArgs_ > 4, let _min_ be ? ToNumber(_values_[4]); else let _min_ be *+0*<sub>𝔽</sub>.
1. If _numberOfArgs_ > 5, let _s_ be ? ToNumber(_values_[5]); else let _s_ be *+0*<sub>𝔽</sub>.
1. If _numberOfArgs_ > 6, let _milli_ be ? ToNumber(_values_[6]); else let _milli_ be *+0*<sub>𝔽</sub>.
1. If _y_ is *NaN*, then
1. Let _yr_ be *NaN*.
1. Else,
1. Let _yi_ be ! ToIntegerOrInfinity(_y_).
1. If 0 ≤ _yi_ ≤ 99, let _yr_ be *1900*<sub>𝔽</sub> + 𝔽(_yi_); otherwise, let _yr_ be _y_.
1. Let _finalDate_ be MakeDate(MakeDay(_yr_, _m_, _dt_), MakeTime(_h_, _min_, _s_, _milli_)).
1. Let _dv_ be TimeClip(UTC(_finalDate_)).
1. Let _O_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%Date.prototype%"*, « [[DateValue]] »).
1. Set _O_.[[DateValue]] to _dv_.
1. Return _O_.
</emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>

<emu-clause id="sec-temporal-properties-of-the-date-constructor">
<h1><a href="https://tc39.es/ecma262/#sec-properties-of-the-date-constructor">Properties of the Date Constructor</a></h1>
<emu-clause id="sec-temporal-properties-of-the-date-constructor">
<h1><a href="https://tc39.es/ecma262/#sec-properties-of-the-date-constructor">Properties of the Date Constructor</a></h1>

<emu-clause id="sec-temporal-date.now">
<h1><a href="https://tc39.es/ecma262/#sec-date.now">Date.now ( )</a></h1>
<del class="block">
<p>This function returns the time value designating the UTC date and time of the occurrence of the call to it.</p>
</del>
<ins class="block">
<p>This function performs the following steps when called:</p>
<emu-alg>
1. Return SystemUTCEpochMilliseconds().
</emu-alg>
</ins>
<emu-clause id="sec-temporal-date.now">
<h1><a href="https://tc39.es/ecma262/#sec-date.now">Date.now ( )</a></h1>
<del class="block">
<p>This function returns the time value designating the UTC date and time of the occurrence of the call to it.</p>
</del>
<ins class="block">
<p>This function performs the following steps when called:</p>
<emu-alg>
1. Let _global_ be GetGlobalObject().
1. Let _nowNs_ be HostSystemUTCEpochNanoseconds(_global_).
1. Return 𝔽(floor(_nowNs_ / 10<sup>6</sup>)).
</emu-alg>
</ins>
</emu-clause>
</emu-clause>
</emu-clause>

<emu-clause id="sec-temporal-properties-of-the-legacy-date-prototype-object">
<h1><a href="https://tc39.es/ecma262/#sec-properties-of-the-date-prototype-object">Properties of the Date Prototype Object</a></h1>
<emu-clause id="sec-temporal-properties-of-the-legacy-date-prototype-object">
<h1><a href="https://tc39.es/ecma262/#sec-properties-of-the-date-prototype-object">Properties of the Date Prototype Object</a></h1>

<ins class="block">
<emu-clause id="sec-date.prototype.totemporalinstant">
<h1>Date.prototype.toTemporalInstant ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _t_ be ? thisTimeValue(*this* value).
1. Let _ns_ be ? NumberToBigInt(_t_) &times; ℤ(10<sup>6</sup>).
1. Return ! CreateTemporalInstant(_ns_).
</emu-alg>
</emu-clause>
</ins>
<ins class="block">
<emu-clause id="sec-date.prototype.totemporalinstant">
<h1>Date.prototype.toTemporalInstant ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _t_ be ? thisTimeValue(*this* value).
1. Let _ns_ be ? NumberToBigInt(_t_) &times; ℤ(10<sup>6</sup>).
1. Return ! CreateTemporalInstant(_ns_).
</emu-alg>
</emu-clause>
</ins>
</emu-clause>
</emu-clause>
</emu-clause>

0 comments on commit fc56deb

Please sign in to comment.