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: More structured headers #2161

Merged
merged 3 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions spec/abstractops.html
Original file line number Diff line number Diff line change
Expand Up @@ -1208,8 +1208,8 @@ <h1>ParseISODateTime ( _isoString_ )</h1>
1. Let _millisecond_ be 0.
1. Let _microsecond_ be 0.
1. Let _nanosecond_ be 0.
1. If ! IsValidISODate(_year_, _month_, _day_) is *false*, throw a *RangeError* exception.
1. If ! IsValidTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_) is *false*, throw a *RangeError* exception.
1. If IsValidISODate(_year_, _month_, _day_) is *false*, throw a *RangeError* exception.
1. If IsValidTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_) is *false*, throw a *RangeError* exception.
1. Return the Record {
[[Year]]: _year_,
[[Month]]: _month_,
Expand Down
8 changes: 4 additions & 4 deletions spec/instant.html
Original file line number Diff line number Diff line change
Expand Up @@ -544,12 +544,12 @@ <h1>ParseTemporalInstant ( _isoString_ )</h1>
1. Let _result_ be ? ParseTemporalInstantString(_isoString_).
1. Let _offsetString_ be _result_.[[TimeZoneOffsetString]].
1. Assert: _offsetString_ is not *undefined*.
1. Let _utc_ be ! GetEpochFromISOParts(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]).
1. If _utc_ &lt; −8.64 × 10<sup>21</sup> or _utc_ &gt; 8.64 × 10<sup>21</sup>, then
1. Let _utc_ be GetEpochFromISOParts(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]).
1. If ℝ(_utc_) &lt; −8.64 × 10<sup>21</sup> or ℝ(_utc_) &gt; 8.64 × 10<sup>21</sup>, then
1. Throw a *RangeError* exception.
1. Let _offsetNanoseconds_ be ? ParseTimeZoneOffsetString(_offsetString_).
1. Let _result_ be _utc_ − _offsetNanoseconds_.
1. If ! IsValidEpochNanoseconds(ℤ(_result_)) is *false*, then
1. Let _result_ be _utc_ − ℤ(_offsetNanoseconds_).
1. If ! IsValidEpochNanoseconds(_result_) is *false*, then
1. Throw a *RangeError* exception.
1. Return _result_.
</emu-alg>
Expand Down
2 changes: 1 addition & 1 deletion spec/intl.html
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ <h1>ToLocalTime ( _t_, _calendar_, _timeZone_ )</h1>
1. Assert: Type(_t_) is <del>Number</del><ins>BigInt</ins>.
1. If _calendar_ is *"gregory"*, then
1. <del>Let _timeZoneOffset_ be the value calculated according to <emu-xref href="#sec-local-time-zone-adjustment">LocalTZA(_t_, *true*)</emu-xref> where the local time zone is replaced with timezone _timeZone_.</del>
1. <ins>Let _timeZoneOffset_ be ! GetIANATimeZoneOffsetNanoseconds(_t_, _timeZone_).</ins>
1. <ins>Let _timeZoneOffset_ be GetIANATimeZoneOffsetNanoseconds(_t_, _timeZone_).</ins>
1. Let _tz_ be <del>_t_</del><ins>ℝ(_t_)</ins> + _timeZoneOffset_.
1. Return a record with fields calculated from _tz_ according to <del><emu-xref href="#table-datetimeformat-tolocaltime-record"></emu-xref></del><ins><emu-xref href="#table-temporal-plaindatetimeformat-tolocaltime-record"></emu-xref></ins>.
1. Else,
Expand Down
29 changes: 19 additions & 10 deletions spec/plaindate.html
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,8 @@ <h1>CreateTemporalDate ( _isoYear_, _isoMonth_, _isoDay_, _calendar_ [ , _newTar
1. Assert: _isoMonth_ is an integer.
1. Assert: _isoDay_ is an integer.
1. Assert: Type(_calendar_) is Object.
1. If ! IsValidISODate(_isoYear_, _isoMonth_, _isoDay_) is *false*, throw a *RangeError* exception.
1. If ! ISODateTimeWithinLimits(_isoYear_, _isoMonth_, _isoDay_, 12, 0, 0, 0, 0, 0) is *false*, throw a *RangeError* exception.
1. If IsValidISODate(_isoYear_, _isoMonth_, _isoDay_) is *false*, throw a *RangeError* exception.
1. If ISODateTimeWithinLimits(_isoYear_, _isoMonth_, _isoDay_, 12, 0, 0, 0, 0, 0) is *false*, throw a *RangeError* exception.
1. If _newTarget_ is not present, set _newTarget_ to %Temporal.PlainDate%.
1. Let _object_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%Temporal.PlainDate.prototype%"*, « [[InitializedTemporalDate]], [[ISOYear]], [[ISOMonth]], [[ISODay]], [[Calendar]] »).
1. Set _object_.[[ISOYear]] to _isoYear_.
Expand Down Expand Up @@ -692,7 +692,7 @@ <h1>ToTemporalDate ( _item_ [ , _options_ ] )</h1>
1. Perform ? ToTemporalOverflow(_options_).
1. Let _string_ be ? ToString(_item_).
1. Let _result_ be ? ParseTemporalDateString(_string_).
1. Assert: ! IsValidISODate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*.
1. Assert: IsValidISODate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*.
1. Let _calendar_ be ? ToTemporalCalendarWithISODefault(_result_.[[Calendar]]).
1. Return ? CreateTemporalDate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _calendar_).
</emu-alg>
Expand Down Expand Up @@ -783,7 +783,7 @@ <h1>RegulateISODate ( _year_, _month_, _day_, _overflow_ )</h1>
1. Assert: _year_, _month_, and _day_ are integers.
1. Assert: _overflow_ is either *"constrain"* or *"reject"*.
1. If _overflow_ is *"reject"*, then
1. If ! IsValidISODate(_year_, _month_, _day_) is *false*, throw a *RangeError* exception.
1. If IsValidISODate(_year_, _month_, _day_) is *false*, throw a *RangeError* exception.
1. Return the Record {
[[Year]]: _year_,
[[Month]]: _month_,
Expand All @@ -801,12 +801,21 @@ <h1>RegulateISODate ( _year_, _month_, _day_, _overflow_ )</h1>
</emu-alg>
</emu-clause>

<emu-clause id="sec-temporal-isvalidisodate" aoid="IsValidISODate">
<h1>IsValidISODate ( _year_, _month_, _day_ )</h1>
<p>
The abstract operation IsValidISODate returns *true* if its arguments form a valid date in the ISO 8601 calendar, and *false* otherwise.
This includes dates that may fall outside of the allowed range for Temporal.
</p>
<emu-clause id="sec-temporal-isvalidisodate" type="abstract operation">
<h1>
IsValidISODate (
_year_: an integer,
_month_: an integer,
_day_: an integer,
): a Boolean
</h1>
<dl class="header">
<dt>description</dt>
<dd>
The return value is *true* if its arguments form a valid date in the ISO 8601 calendar, and *false* otherwise.
This includes dates that may fall outside of the allowed range for Temporal.
</dd>
</dl>
<emu-alg>
1. Assert: _year_, _month_, and _day_ are integers.
1. If _month_ &lt; 1 or _month_ &gt; 12, then
Expand Down
71 changes: 50 additions & 21 deletions spec/plaindatetime.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ <h1>Temporal.PlainDateTime.prototype.with ( _temporalDateTimeLike_ [ , _options_
1. Set _fields_ to ? CalendarMergeFields(_calendar_, _fields_, _partialDateTime_).
1. Set _fields_ to ? PrepareTemporalFields(_fields_, _fieldNames_, «»).
1. Let _result_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _options_).
1. Assert: ! IsValidISODate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*.
1. Assert: ! IsValidTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*.
1. Assert: IsValidISODate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*.
1. Assert: IsValidTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*.
1. Return ? CreateTemporalDateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]], _calendar_).
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -455,8 +455,8 @@ <h1>Temporal.PlainDateTime.prototype.add ( _temporalDurationLike_ [ , _options_
1. Let _duration_ be ? ToTemporalDurationRecord(_temporalDurationLike_).
1. Set _options_ to ? GetOptionsObject(_options_).
1. Let _result_ be ? AddDateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _dateTime_.[[Calendar]], _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], _options_).
1. Assert: ! IsValidISODate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*.
1. Assert: ! IsValidTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*.
1. Assert: IsValidISODate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*.
1. Assert: IsValidTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*.
1. Return ? CreateTemporalDateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]], _dateTime_.[[Calendar]]).
</emu-alg>
</emu-clause>
Expand All @@ -473,8 +473,8 @@ <h1>Temporal.PlainDateTime.prototype.subtract ( _temporalDurationLike_ [ , _opti
1. Let _duration_ be ? ToTemporalDurationRecord(_temporalDurationLike_).
1. Set _options_ to ? GetOptionsObject(_options_).
1. Let _result_ be ? AddDateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _dateTime_.[[Calendar]], −_duration_.[[Years]], −_duration_.[[Months]], −_duration_.[[Weeks]], −_duration_.[[Days]], −_duration_.[[Hours]], −_duration_.[[Minutes]], −_duration_.[[Seconds]], −_duration_.[[Milliseconds]], −_duration_.[[Microseconds]], −_duration_.[[Nanoseconds]], _options_).
1. Assert: ! IsValidISODate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*.
1. Assert: ! IsValidTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*.
1. Assert: IsValidISODate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*.
1. Assert: IsValidTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*.
1. Return ? CreateTemporalDateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]], _dateTime_.[[Calendar]]).
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -840,31 +840,60 @@ <h1>Properties of Temporal.PlainDateTime Instances</h1>
<emu-clause id="sec-temporal-plaindatetime-abstract-ops">
<h1>Abstract operations</h1>

<emu-clause id="sec-temporal-getepochfromisoparts" aoid="GetEpochFromISOParts">
<h1>GetEpochFromISOParts ( _year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_ )</h1>
<emu-clause id="sec-temporal-getepochfromisoparts" type="abstract operation">
<h1>
GetEpochFromISOParts (
_year_: an integer,
_month_: an integer between 1 and 12 inclusive,
_day_: an integer between 1 and 31 inclusive,
_hour_: an integer between 0 and 23 inclusive,
_minute_: an integer between 0 and 59 inclusive,
_second_: an integer between 0 and 59 inclusive,
_millisecond_: an integer between 0 and 999 inclusive,
_microsecond_: an integer between 0 and 999 inclusive,
_nanosecond_: an integer between 0 and 999 inclusive,
): a BigInt
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was treated as integer in some places and BigInt in others. I picked BigInt but could go either way.

</h1>
<dl class="header">
<dt>description</dt>
<dd>The returned value represents a number of nanoseconds since the Unix epoch in UTC that corresponds to the given ISO 8601 calendar date and wall-clock time in UTC.</dd>
</dl>
<emu-alg>
1. Assert: _year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, and _nanosecond_ are integers.
1. Assert: ! IsValidISODate(_year_, _month_, _day_) is *true*.
1. Assert: ! IsValidTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_) is *true*.
1. Assert: IsValidISODate(_year_, _month_, _day_) is *true*.
1. Let _date_ be MakeDay(𝔽(_year_), 𝔽(_month_ − 1), 𝔽(_day_)).
1. Let _time_ be MakeTime(𝔽(_hour_), 𝔽(_minute_), 𝔽(_second_), 𝔽(_millisecond_)).
1. Let _ms_ be MakeDate(_date_, _time_).
1. Assert: _ms_ is finite.
1. Return ℝ(_ms_) × 10<sup>6</sup> + _microsecond_ × 10<sup>3</sup> + _nanosecond_.
1. Return ℤ(ℝ(_ms_) × 10<sup>6</sup> + _microsecond_ × 10<sup>3</sup> + _nanosecond_).
</emu-alg>
</emu-clause>

<emu-clause id="sec-temporal-isodatetimewithinlimits" aoid="ISODateTimeWithinLimits">
<h1>ISODateTimeWithinLimits ( _year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_ )</h1>
<emu-clause id="sec-temporal-isodatetimewithinlimits" type="abstract operation">
<h1>
ISODateTimeWithinLimits (
_year_: an integer,
_month_: an integer between 1 and 12 inclusive,
_day_: an integer between 1 and 31 inclusive,
_hour_: an integer between 0 and 23 inclusive,
_minute_: an integer between 0 and 59 inclusive,
_second_: an integer between 0 and 59 inclusive,
_millisecond_: an integer between 0 and 999 inclusive,
_microsecond_: an integer between 0 and 999 inclusive,
_nanosecond_: an integer between 0 and 999 inclusive,
): a Boolean
</h1>
<dl class="header">
<dt>description</dt>
<dd>The return value is *true* if the combination of a date in the ISO calendar with a wall-clock time, given by the arguments, is within the representable range of `Temporal.PlainDateTime`, and *false* otherwise.</dd>
</dl>
<emu-note>
<p>
Temporal.PlainDateTime objects can represent points in time within 24 hours (8.64 × 10<sup>13</sup> nanoseconds) of the Temporal.Instant boundaries.
This ensures that a Temporal.Instant object can be converted into a Temporal.PlainDateTime object using any time zone.
</p>
</emu-note>
<emu-alg>
1. Assert: _year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, and _nanosecond_ are integers.
1. Let _ns_ be ! GetEpochFromISOParts(_year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_).
1. Let _ns_ be ℝ(GetEpochFromISOParts(_year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_)).
1. If _ns_ ≤ -8.64 × 10<sup>21</sup> - 8.64 × 10<sup>13</sup>, then
1. Return *false*.
1. If _ns_ ≥ 8.64 × 10<sup>21</sup> + 8.64 × 10<sup>13</sup>, then
Expand Down Expand Up @@ -921,8 +950,8 @@ <h1>ToTemporalDateTime ( _item_ [ , _options_ ] )</h1>
1. Perform ? ToTemporalOverflow(_options_).
1. Let _string_ be ? ToString(_item_).
1. Let _result_ be ? ParseTemporalDateTimeString(_string_).
1. Assert: ! IsValidISODate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*.
1. Assert: ! IsValidTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*.
1. Assert: IsValidISODate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*.
1. Assert: IsValidTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*.
1. Let _calendar_ be ? ToTemporalCalendarWithISODefault(_result_.[[Calendar]]).
1. Return ? CreateTemporalDateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]], _calendar_).
</emu-alg>
Expand Down Expand Up @@ -953,9 +982,9 @@ <h1>CreateTemporalDateTime ( _isoYear_, _isoMonth_, _isoDay_, _hour_, _minute_,
<emu-alg>
1. Assert: _isoYear_, _isoMonth_, _isoDay_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, and _nanosecond_ are integers.
1. Assert: Type(_calendar_) is Object.
1. If ! IsValidISODate(_isoYear_, _isoMonth_, _isoDay_) is *false*, throw a *RangeError* exception.
1. If ! IsValidTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_) is *false*, throw a *RangeError* exception.
1. If ! ISODateTimeWithinLimits(_isoYear_, _isoMonth_, _isoDay_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_) is *false*, then
1. If IsValidISODate(_isoYear_, _isoMonth_, _isoDay_) is *false*, throw a *RangeError* exception.
1. If IsValidTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_) is *false*, throw a *RangeError* exception.
1. If ISODateTimeWithinLimits(_isoYear_, _isoMonth_, _isoDay_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_) is *false*, then
1. Throw a *RangeError* exception.
1. If _newTarget_ is not present, set _newTarget_ to %Temporal.PlainDateTime%.
1. Let _object_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%Temporal.PlainDateTime.prototype%"*, « [[InitializedTemporalDateTime]], [[ISOYear]], [[ISOMonth]], [[ISODay]], [[ISOHour]], [[ISOMinute]], [[ISOSecond]], [[ISOMillisecond]], [[ISOMicrosecond]], [[ISONanosecond]], [[Calendar]] »).
Expand Down
2 changes: 1 addition & 1 deletion spec/plainmonthday.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ <h1>CreateTemporalMonthDay ( _isoMonth_, _isoDay_, _calendar_, _referenceISOYear
<emu-alg>
1. Assert: _isoMonth_, _isoDay_, and _referenceISOYear_ are integers.
1. Assert: Type(_calendar_) is Object.
1. If ! IsValidISODate(_referenceISOYear_, _isoMonth_, _isoDay_) is *false*, throw a *RangeError* exception.
1. If IsValidISODate(_referenceISOYear_, _isoMonth_, _isoDay_) is *false*, throw a *RangeError* exception.
1. If _newTarget_ is not present, set _newTarget_ to %Temporal.PlainMonthDay%.
1. Let _object_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%Temporal.PlainMonthDay.prototype%"*, « [[InitializedTemporalMonthDay]], [[ISOMonth]], [[ISODay]], [[ISOYear]], [[Calendar]] »).
1. Set _object_.[[ISOMonth]] to _isoMonth_.
Expand Down
Loading