From 9578597967b9a5b9bf212991b10970be9623ff34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:51:27 +0200 Subject: [PATCH] Editorial: Inline CheckISODaysRange --- spec/abstractops.html | 21 --------------------- spec/duration.html | 10 +++++----- spec/instant.html | 2 +- spec/plaindate.html | 2 +- spec/timezone.html | 6 +++--- spec/zoneddatetime.html | 8 ++++---- 6 files changed, 14 insertions(+), 35 deletions(-) diff --git a/spec/abstractops.html b/spec/abstractops.html index acbeb7574..3532ebd09 100644 --- a/spec/abstractops.html +++ b/spec/abstractops.html @@ -108,27 +108,6 @@

Date Equations

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

- CheckISODaysRange ( - _isoDateTime_: an ISO Date-Time Record, - ): either a normal completion containing ~unused~ or a throw completion -

-
-
description
-
It checks that the given date-time is within the range of 108 days from the epoch.
-
- - 1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, then - 1. Throw a *RangeError* exception. - 1. Return ~unused~. - - - This operation is solely present to ensure that GetUTCEpochNanoseconds is not called with numbers that are too large. - This operation can be removed with no observable effect when https://github.com/tc39/ecma262/issues/1087 is fixed. - -
-

Units

diff --git a/spec/duration.html b/spec/duration.html index 07ea59acc..d4bb98ad2 100644 --- a/spec/duration.html +++ b/spec/duration.html @@ -1638,8 +1638,8 @@

1. Let _startEpochNs_ be GetUTCEpochNanoseconds(_startDateTime_). 1. Let _endEpochNs_ be GetUTCEpochNanoseconds(_endDateTime_). 1. Else, - 1. Perform ? CheckISODaysRange(_startDateTime_). - 1. Perform ? CheckISODaysRange(_endDateTime_). + 1. If ISODateTimeWithinLimits(_startDateTime_) is *false*, throw a *RangeError* exception. + 1. If ISODateTimeWithinLimits(_endDateTime_) is *false*, throw a *RangeError* exception. 1. Let _startEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _startDateTime_, ~compatible~). 1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~). 1. If _sign_ is 1, then @@ -1694,10 +1694,10 @@

1. Let _start_ be ? CalendarDateAdd(_calendar_, _isoDateTime_.[[ISODate]], _duration_.[[Date]], ~constrain~). 1. Let _startDateTime_ be CombineISODateAndTimeRecord(_start_, _isoDateTime_.[[Time]]). - 1. Perform ? CheckISODaysRange(_startDateTime_). + 1. If ISODateTimeWithinLimits(_startDateTime_) is *false*, throw a *RangeError* exception. 1. Let _endDate_ be AddDaysToISODate(_start_, _sign_). 1. Let _endDateTime_ be CombineISODateAndTimeRecord(_endDate_, _isoDateTime_.[[Time]]). - 1. Perform ? CheckISODaysRange(_endDateTime_). + 1. If ISODateTimeWithinLimits(_endDateTime_) is *false*, throw a *RangeError* exception. 1. Let _startEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _startDateTime_, ~compatible~). 1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~). 1. Let _daySpan_ be TimeDurationFromEpochNanosecondsDifference(_endEpochNs_, _startEpochNs_). @@ -1802,7 +1802,7 @@

1. If _timeZone_ is ~unset~, then 1. Let _endEpochNs_ be GetUTCEpochNanoseconds(_endDateTime_). 1. Else, - 1. Perform ? CheckISODaysRange(_endDateTime_). + 1. If ISODateTimeWithinLimits(_endDateTime_) is *false*, throw a *RangeError* exception. 1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~). 1. Let _beyondEnd_ be _nudgedEpochNs_ - _endEpochNs_. 1. If _beyondEnd_ < 0, let _beyondEndSign_ be -1; else if _beyondEnd_ > 0, let _beyondEndSign_ be 1; else let _beyondEndSign_ be 0. diff --git a/spec/instant.html b/spec/instant.html index 5640528b7..ae6ed8534 100644 --- a/spec/instant.html +++ b/spec/instant.html @@ -415,7 +415,7 @@

1. If _parsed_.[[Time]] is ~start-of-day~, let _time_ be MidnightTimeRecord(); else let _time_ be _parsed_.[[Time]]. 1. Let _isoDate_ be CreateISODateRecord(_parsed_.[[Year]], _parsed_.[[Month]], _parsed_.[[Day]]). 1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, _time_). - 1. Perform ? CheckISODaysRange(_isoDateTime_). + 1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception. 1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_isoDateTime_) - _offsetNanoseconds_. 1. If IsValidEpochNanoseconds(_epochNanoseconds_) is *false*, throw a *RangeError* exception. 1. Return ! CreateTemporalInstant(_epochNanoseconds_). diff --git a/spec/plaindate.html b/spec/plaindate.html index aab7011eb..9f078a1bf 100644 --- a/spec/plaindate.html +++ b/spec/plaindate.html @@ -460,7 +460,7 @@

Temporal.PlainDate.prototype.toZonedDateTime ( _item_ )

1. Else, 1. Set _temporalTime_ to ? ToTemporalTime(_temporalTime_). 1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_temporalDate_.[[ISODate]], _temporalTime_.[[Time]]). - 1. Perform ? CheckISODaysRange(_isoDateTime_). + 1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception. 1. Let _epochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _isoDateTime_, ~compatible~). 1. Return ! CreateTemporalZonedDateTime(_epochNs_, _timeZone_, _temporalDate_.[[Calendar]]).
diff --git a/spec/timezone.html b/spec/timezone.html index 288cc1b15..d5ae611a2 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -323,7 +323,7 @@

1. Let _earlierTime_ be AddTime(_isoDateTime_.[[Time]], _timeDuration_). 1. Let _earlierDate_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _earlierTime_.[[Days]]). 1. Let _earlierDateTime_ be CombineISODateAndTimeRecord(_earlierDate_, _earlierTime_). - 1. Perform ? CheckISODaysRange(_earlierDateTime_). + 1. If ISODateTimeWithinLimits(_earlierDateTime_) is *false*, throw a *RangeError* exception. 1. Set _possibleEpochNs_ to ? GetPossibleEpochNanoseconds(_timeZone_, _earlierDateTime_). 1. Assert: _possibleEpochNs_ is not empty. 1. Return _possibleEpochNs_[0]. @@ -332,7 +332,7 @@

1. Let _laterTime_ be AddTime(_isoDateTime_.[[Time]], _timeDuration_). 1. Let _laterDate_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _laterTime_.[[Days]]). 1. Let _laterDateTime_ be CombineISODateAndTimeRecord(_laterDate_, _laterTime_). - 1. Perform ? CheckISODaysRange(_laterDateTime_). + 1. If ISODateTimeWithinLimits(_laterDateTime_) is *false*, throw a *RangeError* exception. 1. Set _possibleEpochNs_ to ? GetPossibleEpochNanoseconds(_timeZone_, _laterDateTime_). 1. Set _n_ to _possibleEpochNs_'s length. 1. Assert: _n_ ≠ 0. @@ -381,7 +381,7 @@

1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, MidnightTimeRecord()). - 1. Perform ? CheckISODaysRange(_isoDateTime_). + 1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception. 1. Let _possibleEpochNs_ be ? GetPossibleEpochNanoseconds(_timeZone_, _isoDateTime_). 1. If _possibleEpochNs_ is not empty, return _possibleEpochNs_[0]. 1. Assert: IsOffsetTimeZoneIdentifier(_timeZone_) is *false*. diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index 1d6ce6c8c..0dcd34ed8 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -550,7 +550,7 @@

Temporal.ZonedDateTime.prototype.withPlainTime ( [ _plainTimeLike_ ] )

1. Else, 1. Let _plainTime_ be ? ToTemporalTime(_plainTimeLike_). 1. Let _resultISODateTime_ be CombineISODateAndTimeRecord(_isoDateTime_.[[ISODate]], _plainTime_.[[Time]]). - 1. Perform ? CheckISODaysRange(_resultISODateTime_). + 1. If ISODateTimeWithinLimits(_resultISODateTime_) is *false*, throw a *RangeError* exception. 1. Let _epochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _resultISODateTime_, ~compatible~). 1. Return ! CreateTemporalZonedDateTime(_epochNs_, _timeZone_, _calendar_).
@@ -907,7 +907,7 @@

- 1. Perform ? CheckISODaysRange(_isoDateTime_). + 1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception. 1. If _offsetBehaviour_ is ~wall~, or _offsetBehaviour_ is ~option~ and _offsetOption_ is ~ignore~, then 1. Return ? GetEpochNanosecondsFor(_timeZone_, _isoDateTime_, _disambiguation_). 1. If _offsetBehaviour_ is ~exact~, or _offsetBehaviour_ is ~option~ and _offsetOption_ is ~use~, then @@ -1092,7 +1092,7 @@

1. Let _isoDateTime_ be GetISODateTimeFor(_timeZone_, _epochNanoseconds_). 1. Let _addedDate_ be ? CalendarDateAdd(_calendar_, _isoDateTime_.[[ISODate]], _duration_.[[Date]], _overflow_). 1. Let _intermediateDateTime_ be CombineISODateAndTimeRecord(_addedDate_, _isoDateTime_.[[Time]]). - 1. Perform ? CheckISODaysRange(_intermediateDateTime_). + 1. If ISODateTimeWithinLimits(_intermediateDateTime_) is *false*, throw a *RangeError* exception. 1. Let _intermediateNs_ be ! GetEpochNanosecondsFor(_timeZone_, _intermediateDateTime_, ~compatible~). 1. Return ? AddInstant(_intermediateNs_, _duration_.[[Time]]). @@ -1129,7 +1129,7 @@

1. Repeat, while _dayCorrection_ ≤ _maxDayCorrection_ and _success_ is *false*, 1. Let _intermediateDate_ be AddDaysToISODate(_endDateTime_.[[ISODate]], _dayCorrection_ × _sign_). 1. Let _intermediateDateTime_ be CombineISODateAndTimeRecord(_intermediateDate_, _startDateTime_.[[Time]]). - 1. Perform ? CheckISODaysRange(_intermediateDateTime_). + 1. If ISODateTimeWithinLimits(_intermediateDateTime_) is *false*, throw a *RangeError* exception. 1. Let _intermediateNs_ be ? GetEpochNanosecondsFor(_timeZone_, _intermediateDateTime_, ~compatible~). 1. Set _timeDuration_ to TimeDurationFromEpochNanosecondsDifference(_ns2_, _intermediateNs_). 1. Let _timeSign_ be TimeDurationSign(_timeDuration_).