Skip to content

Commit 014eb8b

Browse files
anbaptomato
authored andcommitted
Editorial: Inline CheckISODaysRange
1 parent d1529f5 commit 014eb8b

File tree

6 files changed

+14
-35
lines changed

6 files changed

+14
-35
lines changed

spec/abstractops.html

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,27 +108,6 @@ <h1>Date Equations</h1>
108108
<emu-note type="editor"> Note that the operation EpochTimeToMonthInYear(_t_) uses 0-based months unlike rest of Temporal since it's intended to be unified with MonthFromTime(_t_) when the above mentioned issue is fixed.</emu-note>
109109
</emu-clause>
110110

111-
<emu-clause id="sec-checkisodaysrange" type="abstract operation">
112-
<h1>
113-
CheckISODaysRange (
114-
_isoDateTime_: an ISO Date-Time Record,
115-
): either a normal completion containing ~unused~ or a throw completion
116-
</h1>
117-
<dl class="header">
118-
<dt>description</dt>
119-
<dd>It checks that the given date-time is within the range of 10<sup>8</sup> days from the epoch.</dd>
120-
</dl>
121-
<emu-alg>
122-
1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, then
123-
1. Throw a *RangeError* exception.
124-
1. Return ~unused~.
125-
</emu-alg>
126-
<emu-note type="editor">
127-
This operation is solely present to ensure that GetUTCEpochNanoseconds is not called with numbers that are too large.
128-
This operation can be removed with no observable effect when https://github.com/tc39/ecma262/issues/1087 is fixed.
129-
</emu-note>
130-
</emu-clause>
131-
132111
<emu-clause id="sec-temporal-units">
133112
<h1>Units</h1>
134113
<p>

spec/duration.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,14 +1625,14 @@ <h1>
16251625
1. If _timeZone_ is ~unset~, then
16261626
1. Let _startEpochNs_ be GetUTCEpochNanoseconds(_startDateTime_).
16271627
1. Else,
1628-
1. Perform ? CheckISODaysRange(_startDateTime_).
1628+
1. If ISODateTimeWithinLimits(_startDateTime_) is *false*, throw a *RangeError* exception.
16291629
1. Let _startEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _startDateTime_, ~compatible~).
16301630
1. Let _end_ be ? CalendarDateAdd(_calendar_, _isoDateTime_.[[ISODate]], _endDuration_, ~constrain~).
16311631
1. Let _endDateTime_ be CombineISODateAndTimeRecord(_end_, _isoDateTime_.[[Time]]).
16321632
1. If _timeZone_ is ~unset~, then
16331633
1. Let _endEpochNs_ be GetUTCEpochNanoseconds(_endDateTime_).
16341634
1. Else,
1635-
1. Perform ? CheckISODaysRange(_endDateTime_).
1635+
1. If ISODateTimeWithinLimits(_endDateTime_) is *false*, throw a *RangeError* exception.
16361636
1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~).
16371637
1. If _sign_ is 1, then
16381638
1. Assert: _startEpochNs__destEpochNs__endEpochNs_.
@@ -1686,10 +1686,10 @@ <h1>
16861686
<emu-alg>
16871687
1. Let _start_ be ? CalendarDateAdd(_calendar_, _isoDateTime_.[[ISODate]], _duration_.[[Date]], ~constrain~).
16881688
1. Let _startDateTime_ be CombineISODateAndTimeRecord(_start_, _isoDateTime_.[[Time]]).
1689-
1. Perform ? CheckISODaysRange(_startDateTime_).
1689+
1. If ISODateTimeWithinLimits(_startDateTime_) is *false*, throw a *RangeError* exception.
16901690
1. Let _endDate_ be AddDaysToISODate(_start_, _sign_).
16911691
1. Let _endDateTime_ be CombineISODateAndTimeRecord(_endDate_, _isoDateTime_.[[Time]]).
1692-
1. Perform ? CheckISODaysRange(_endDateTime_).
1692+
1. If ISODateTimeWithinLimits(_endDateTime_) is *false*, throw a *RangeError* exception.
16931693
1. Let _startEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _startDateTime_, ~compatible~).
16941694
1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~).
16951695
1. Let _daySpan_ be TimeDurationFromEpochNanosecondsDifference(_endEpochNs_, _startEpochNs_).
@@ -1794,7 +1794,7 @@ <h1>
17941794
1. If _timeZone_ is ~unset~, then
17951795
1. Let _endEpochNs_ be GetUTCEpochNanoseconds(_endDateTime_).
17961796
1. Else,
1797-
1. Perform ? CheckISODaysRange(_endDateTime_).
1797+
1. If ISODateTimeWithinLimits(_endDateTime_) is *false*, throw a *RangeError* exception.
17981798
1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~).
17991799
1. Let _beyondEnd_ be _nudgedEpochNs_ - _endEpochNs_.
18001800
1. If _beyondEnd_ &lt; 0, let _beyondEndSign_ be -1; else if _beyondEnd_ > 0, let _beyondEndSign_ be 1; else let _beyondEndSign_ be 0.

spec/instant.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ <h1>
416416
1. If _parsed_.[[Time]] is ~start-of-day~, let _time_ be MidnightTimeRecord(); else let _time_ be _parsed_.[[Time]].
417417
1. Let _isoDate_ be CreateISODateRecord(_parsed_.[[Year]], _parsed_.[[Month]], _parsed_.[[Day]]).
418418
1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, _time_).
419-
1. Perform ? CheckISODaysRange(_isoDateTime_).
419+
1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception.
420420
1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_isoDateTime_) - _offsetNanoseconds_.
421421
1. If IsValidEpochNanoseconds(_epochNanoseconds_) is *false*, throw a *RangeError* exception.
422422
1. Return ! CreateTemporalInstant(_epochNanoseconds_).

spec/plaindate.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ <h1>Temporal.PlainDate.prototype.toZonedDateTime ( _item_ )</h1>
460460
1. Else,
461461
1. Set _temporalTime_ to ? ToTemporalTime(_temporalTime_).
462462
1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_plainDate_.[[ISODate]], _temporalTime_.[[Time]]).
463-
1. Perform ? CheckISODaysRange(_isoDateTime_).
463+
1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception.
464464
1. Let _epochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _isoDateTime_, ~compatible~).
465465
1. Return ! CreateTemporalZonedDateTime(_epochNs_, _timeZone_, _plainDate_.[[Calendar]]).
466466
</emu-alg>

spec/timezone.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ <h1>
329329
1. Let _earlierTime_ be AddTime(_isoDateTime_.[[Time]], _timeDuration_).
330330
1. Let _earlierDate_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _earlierTime_.[[Days]]).
331331
1. Let _earlierDateTime_ be CombineISODateAndTimeRecord(_earlierDate_, _earlierTime_).
332-
1. Perform ? CheckISODaysRange(_earlierDateTime_).
332+
1. If ISODateTimeWithinLimits(_earlierDateTime_) is *false*, throw a *RangeError* exception.
333333
1. Set _possibleEpochNs_ to ? GetPossibleEpochNanoseconds(_timeZone_, _earlierDateTime_).
334334
1. Assert: _possibleEpochNs_ is not empty.
335335
1. Return _possibleEpochNs_[0].
@@ -338,7 +338,7 @@ <h1>
338338
1. Let _laterTime_ be AddTime(_isoDateTime_.[[Time]], _timeDuration_).
339339
1. Let _laterDate_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _laterTime_.[[Days]]).
340340
1. Let _laterDateTime_ be CombineISODateAndTimeRecord(_laterDate_, _laterTime_).
341-
1. Perform ? CheckISODaysRange(_laterDateTime_).
341+
1. If ISODateTimeWithinLimits(_laterDateTime_) is *false*, throw a *RangeError* exception.
342342
1. Set _possibleEpochNs_ to ? GetPossibleEpochNanoseconds(_timeZone_, _laterDateTime_).
343343
1. Set _n_ to _possibleEpochNs_'s length.
344344
1. Assert: _n_ ≠ 0.
@@ -387,7 +387,7 @@ <h1>
387387
</dl>
388388
<emu-alg>
389389
1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, MidnightTimeRecord()).
390-
1. Perform ? CheckISODaysRange(_isoDateTime_).
390+
1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception.
391391
1. Let _possibleEpochNs_ be ? GetPossibleEpochNanoseconds(_timeZone_, _isoDateTime_).
392392
1. If _possibleEpochNs_ is not empty, return _possibleEpochNs_[0].
393393
1. Assert: IsOffsetTimeZoneIdentifier(_timeZone_) is *false*.

spec/zoneddatetime.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ <h1>Temporal.ZonedDateTime.prototype.withPlainTime ( [ _plainTimeLike_ ] )</h1>
549549
1. Else,
550550
1. Let _plainTime_ be ? ToTemporalTime(_plainTimeLike_).
551551
1. Let _resultISODateTime_ be CombineISODateAndTimeRecord(_isoDateTime_.[[ISODate]], _plainTime_.[[Time]]).
552-
1. Perform ? CheckISODaysRange(_resultISODateTime_).
552+
1. If ISODateTimeWithinLimits(_resultISODateTime_) is *false*, throw a *RangeError* exception.
553553
1. Let _epochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _resultISODateTime_, ~compatible~).
554554
1. Return ! CreateTemporalZonedDateTime(_epochNs_, _timeZone_, _calendar_).
555555
</emu-alg>
@@ -908,7 +908,7 @@ <h1>
908908
</dd>
909909
</dl>
910910
<emu-alg>
911-
1. Perform ? CheckISODaysRange(_isoDateTime_).
911+
1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception.
912912
1. If _offsetBehaviour_ is ~wall~, or _offsetBehaviour_ is ~option~ and _offsetOption_ is ~ignore~, then
913913
1. Return ? GetEpochNanosecondsFor(_timeZone_, _isoDateTime_, _disambiguation_).
914914
1. If _offsetBehaviour_ is ~exact~, or _offsetBehaviour_ is ~option~ and _offsetOption_ is ~use~, then
@@ -1099,7 +1099,7 @@ <h1>
10991099
1. Let _isoDateTime_ be GetISODateTimeFor(_timeZone_, _epochNanoseconds_).
11001100
1. Let _addedDate_ be ? CalendarDateAdd(_calendar_, _isoDateTime_.[[ISODate]], _duration_.[[Date]], _overflow_).
11011101
1. Let _intermediateDateTime_ be CombineISODateAndTimeRecord(_addedDate_, _isoDateTime_.[[Time]]).
1102-
1. Perform ? CheckISODaysRange(_intermediateDateTime_).
1102+
1. If ISODateTimeWithinLimits(_intermediateDateTime_) is *false*, throw a *RangeError* exception.
11031103
1. Let _intermediateNs_ be ! GetEpochNanosecondsFor(_timeZone_, _intermediateDateTime_, ~compatible~).
11041104
1. Return ? AddInstant(_intermediateNs_, _duration_.[[Time]]).
11051105
</emu-alg>
@@ -1139,7 +1139,7 @@ <h1>
11391139
1. Repeat, while _dayCorrection__maxDayCorrection_ and _success_ is *false*,
11401140
1. Let _intermediateDate_ be AddDaysToISODate(_endDateTime_.[[ISODate]], _dayCorrection_ × _sign_).
11411141
1. Let _intermediateDateTime_ be CombineISODateAndTimeRecord(_intermediateDate_, _startDateTime_.[[Time]]).
1142-
1. Perform ? CheckISODaysRange(_intermediateDateTime_).
1142+
1. If ISODateTimeWithinLimits(_intermediateDateTime_) is *false*, throw a *RangeError* exception.
11431143
1. Let _intermediateNs_ be ? GetEpochNanosecondsFor(_timeZone_, _intermediateDateTime_, ~compatible~).
11441144
1. Set _timeDuration_ to TimeDurationFromEpochNanosecondsDifference(_ns2_, _intermediateNs_).
11451145
1. Let _timeSign_ be TimeDurationSign(_timeDuration_).

0 commit comments

Comments
 (0)