Skip to content

Commit 15f103a

Browse files
committed
Editorial: Inline CheckISODaysRange
1 parent c20450b commit 15f103a

File tree

6 files changed

+14
-35
lines changed

6 files changed

+14
-35
lines changed

spec/abstractops.html

-21
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

+5-5
Original file line numberDiff line numberDiff line change
@@ -1638,8 +1638,8 @@ <h1>
16381638
1. Let _startEpochNs_ be GetUTCEpochNanoseconds(_startDateTime_).
16391639
1. Let _endEpochNs_ be GetUTCEpochNanoseconds(_endDateTime_).
16401640
1. Else,
1641-
1. Perform ? CheckISODaysRange(_startDateTime_).
1642-
1. Perform ? CheckISODaysRange(_endDateTime_).
1641+
1. If ISODateTimeWithinLimits(_startDateTime_) is *false*, throw a *RangeError* exception.
1642+
1. If ISODateTimeWithinLimits(_endDateTime_) is *false*, throw a *RangeError* exception.
16431643
1. Let _startEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _startDateTime_, ~compatible~).
16441644
1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~).
16451645
1. If _sign_ is 1, then
@@ -1694,10 +1694,10 @@ <h1>
16941694
<emu-alg>
16951695
1. Let _start_ be ? CalendarDateAdd(_calendar_, _isoDateTime_.[[ISODate]], _duration_.[[Date]], ~constrain~).
16961696
1. Let _startDateTime_ be CombineISODateAndTimeRecord(_start_, _isoDateTime_.[[Time]]).
1697-
1. Perform ? CheckISODaysRange(_startDateTime_).
1697+
1. If ISODateTimeWithinLimits(_startDateTime_) is *false*, throw a *RangeError* exception.
16981698
1. Let _endDate_ be AddDaysToISODate(_start_, _sign_).
16991699
1. Let _endDateTime_ be CombineISODateAndTimeRecord(_endDate_, _isoDateTime_.[[Time]]).
1700-
1. Perform ? CheckISODaysRange(_endDateTime_).
1700+
1. If ISODateTimeWithinLimits(_endDateTime_) is *false*, throw a *RangeError* exception.
17011701
1. Let _startEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _startDateTime_, ~compatible~).
17021702
1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~).
17031703
1. Let _daySpan_ be TimeDurationFromEpochNanosecondsDifference(_endEpochNs_, _startEpochNs_).
@@ -1802,7 +1802,7 @@ <h1>
18021802
1. If _timeZone_ is ~unset~, then
18031803
1. Let _endEpochNs_ be GetUTCEpochNanoseconds(_endDateTime_).
18041804
1. Else,
1805-
1. Perform ? CheckISODaysRange(_endDateTime_).
1805+
1. If ISODateTimeWithinLimits(_endDateTime_) is *false*, throw a *RangeError* exception.
18061806
1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~).
18071807
1. Let _beyondEnd_ be _nudgedEpochNs_ - _endEpochNs_.
18081808
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

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

spec/plaindate.html

+1-1
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(_temporalDate_.[[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_, _temporalDate_.[[Calendar]]).
466466
</emu-alg>

spec/timezone.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ <h1>
323323
1. Let _earlierTime_ be AddTime(_isoDateTime_.[[Time]], _timeDuration_).
324324
1. Let _earlierDate_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _earlierTime_.[[Days]]).
325325
1. Let _earlierDateTime_ be CombineISODateAndTimeRecord(_earlierDate_, _earlierTime_).
326-
1. Perform ? CheckISODaysRange(_earlierDateTime_).
326+
1. If ISODateTimeWithinLimits(_earlierDateTime_) is *false*, throw a *RangeError* exception.
327327
1. Set _possibleEpochNs_ to ? GetPossibleEpochNanoseconds(_timeZone_, _earlierDateTime_).
328328
1. Assert: _possibleEpochNs_ is not empty.
329329
1. Return _possibleEpochNs_[0].
@@ -332,7 +332,7 @@ <h1>
332332
1. Let _laterTime_ be AddTime(_isoDateTime_.[[Time]], _timeDuration_).
333333
1. Let _laterDate_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _laterTime_.[[Days]]).
334334
1. Let _laterDateTime_ be CombineISODateAndTimeRecord(_laterDate_, _laterTime_).
335-
1. Perform ? CheckISODaysRange(_laterDateTime_).
335+
1. If ISODateTimeWithinLimits(_laterDateTime_) is *false*, throw a *RangeError* exception.
336336
1. Set _possibleEpochNs_ to ? GetPossibleEpochNanoseconds(_timeZone_, _laterDateTime_).
337337
1. Set _n_ to _possibleEpochNs_'s length.
338338
1. Assert: _n_ ≠ 0.
@@ -381,7 +381,7 @@ <h1>
381381
</dl>
382382
<emu-alg>
383383
1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, MidnightTimeRecord()).
384-
1. Perform ? CheckISODaysRange(_isoDateTime_).
384+
1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception.
385385
1. Let _possibleEpochNs_ be ? GetPossibleEpochNanoseconds(_timeZone_, _isoDateTime_).
386386
1. If _possibleEpochNs_ is not empty, return _possibleEpochNs_[0].
387387
1. Assert: IsOffsetTimeZoneIdentifier(_timeZone_) is *false*.

spec/zoneddatetime.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ <h1>Temporal.ZonedDateTime.prototype.withPlainTime ( [ _plainTimeLike_ ] )</h1>
550550
1. Else,
551551
1. Let _plainTime_ be ? ToTemporalTime(_plainTimeLike_).
552552
1. Let _resultISODateTime_ be CombineISODateAndTimeRecord(_isoDateTime_.[[ISODate]], _plainTime_.[[Time]]).
553-
1. Perform ? CheckISODaysRange(_resultISODateTime_).
553+
1. If ISODateTimeWithinLimits(_resultISODateTime_) is *false*, throw a *RangeError* exception.
554554
1. Let _epochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _resultISODateTime_, ~compatible~).
555555
1. Return ! CreateTemporalZonedDateTime(_epochNs_, _timeZone_, _calendar_).
556556
</emu-alg>
@@ -907,7 +907,7 @@ <h1>
907907
</dd>
908908
</dl>
909909
<emu-alg>
910-
1. Perform ? CheckISODaysRange(_isoDateTime_).
910+
1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception.
911911
1. If _offsetBehaviour_ is ~wall~, or _offsetBehaviour_ is ~option~ and _offsetOption_ is ~ignore~, then
912912
1. Return ? GetEpochNanosecondsFor(_timeZone_, _isoDateTime_, _disambiguation_).
913913
1. If _offsetBehaviour_ is ~exact~, or _offsetBehaviour_ is ~option~ and _offsetOption_ is ~use~, then
@@ -1091,7 +1091,7 @@ <h1>
10911091
1. Let _isoDateTime_ be GetISODateTimeFor(_timeZone_, _epochNanoseconds_).
10921092
1. Let _addedDate_ be ? CalendarDateAdd(_calendar_, _isoDateTime_.[[ISODate]], _duration_.[[Date]], _overflow_).
10931093
1. Let _intermediateDateTime_ be CombineISODateAndTimeRecord(_addedDate_, _isoDateTime_.[[Time]]).
1094-
1. Perform ? CheckISODaysRange(_intermediateDateTime_).
1094+
1. If ISODateTimeWithinLimits(_intermediateDateTime_) is *false*, throw a *RangeError* exception.
10951095
1. Let _intermediateNs_ be ! GetEpochNanosecondsFor(_timeZone_, _intermediateDateTime_, ~compatible~).
10961096
1. Return ? AddInstant(_intermediateNs_, _duration_.[[Time]]).
10971097
</emu-alg>
@@ -1128,7 +1128,7 @@ <h1>
11281128
1. Repeat, while _dayCorrection__maxDayCorrection_ and _success_ is *false*,
11291129
1. Let _intermediateDate_ be AddDaysToISODate(_endDateTime_.[[ISODate]], _dayCorrection_ × _sign_).
11301130
1. Let _intermediateDateTime_ be CombineISODateAndTimeRecord(_intermediateDate_, _startDateTime_.[[Time]]).
1131-
1. Perform ? CheckISODaysRange(_intermediateDateTime_).
1131+
1. If ISODateTimeWithinLimits(_intermediateDateTime_) is *false*, throw a *RangeError* exception.
11321132
1. Let _intermediateNs_ be ? GetEpochNanosecondsFor(_timeZone_, _intermediateDateTime_, ~compatible~).
11331133
1. Set _timeDuration_ to TimeDurationFromEpochNanosecondsDifference(_ns2_, _intermediateNs_).
11341134
1. Let _timeSign_ be TimeDurationSign(_timeDuration_).

0 commit comments

Comments
 (0)