From c9b21727107406f16ffe0de72a9f80a3d7d902e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:44:49 +0200 Subject: [PATCH 01/15] Editorial: Replace BalanceISODateTime with subtraction --- spec/instant.html | 7 ++++--- spec/timezone.html | 6 +++--- spec/zoneddatetime.html | 5 ++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/instant.html b/spec/instant.html index 6acd832ad..635686b7f 100644 --- a/spec/instant.html +++ b/spec/instant.html @@ -413,9 +413,10 @@

1. Assert: Either _parsed_.[[TimeZone]].[[OffsetString]] is not ~empty~ or _parsed_.[[TimeZone]].[[Z]] is *true*, but not both. 1. If _parsed_.[[TimeZone]].[[Z]] is *true*, let _offsetNanoseconds_ be 0; otherwise, let _offsetNanoseconds_ be ! ParseDateTimeUTCOffset(_parsed_.[[TimeZone]].[[OffsetString]]). 1. If _parsed_.[[Time]] is ~start-of-day~, let _time_ be MidnightTimeRecord(); else let _time_ be _parsed_.[[Time]]. - 1. Let _balanced_ be BalanceISODateTime(_parsed_.[[Year]], _parsed_.[[Month]], _parsed_.[[Day]], _time_.[[Hour]], _time_.[[Minute]], _time_.[[Second]], _time_.[[Millisecond]], _time_.[[Microsecond]], _time_.[[Nanosecond]] - _offsetNanoseconds_). - 1. Perform ? CheckISODaysRange(_balanced_.[[ISODate]]). - 1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_balanced_). + 1. Let _isoDate_ be CreateISODateRecord(_parsed_.[[Year]], _parsed_.[[Month]], _parsed_.[[Day]]). + 1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, _time_). + 1. Perform ? CheckISODaysRange(_isoDate_). + 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/timezone.html b/spec/timezone.html index a2daab54c..50250334f 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -349,9 +349,9 @@

1. Let _parseResult_ be ! ParseTimeZoneIdentifier(_timeZone_). 1. If _parseResult_.[[OffsetMinutes]] is not ~empty~, then - 1. Let _balanced_ be BalanceISODateTime(_isoDateTime_.[[ISODate]].[[Year]], _isoDateTime_.[[ISODate]].[[Month]], _isoDateTime_.[[ISODate]].[[Day]], _isoDateTime_.[[Time]].[[Hour]], _isoDateTime_.[[Time]].[[Minute]] - _parseResult_.[[OffsetMinutes]], _isoDateTime_.[[Time]].[[Second]], _isoDateTime_.[[Time]].[[Millisecond]], _isoDateTime_.[[Time]].[[Microsecond]], _isoDateTime_.[[Time]].[[Nanosecond]]). - 1. Perform ? CheckISODaysRange(_balanced_.[[ISODate]]). - 1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_balanced_). + 1. Let _offsetNanoseconds_ be _parseResult_.[[OffsetMinutes]] × 6 × 1010. + 1. Perform ? CheckISODaysRange(_isoDateTime_.[[ISODate]]). + 1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_isoDateTime_) - _offsetNanoseconds_. 1. Let _possibleEpochNanoseconds_ be « _epochNanoseconds_ ». 1. Else, 1. Perform ? CheckISODaysRange(_isoDateTime_.[[ISODate]]). diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index a693a5a34..ef444cb6d 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -915,9 +915,8 @@

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 - 1. Let _balanced_ be BalanceISODateTime(_isoDate_.[[Year]], _isoDate_.[[Month]], _isoDate_.[[Day]], _time_.[[Hour]], _time_.[[Minute]], _time_.[[Second]], _time_.[[Millisecond]], _time_.[[Microsecond]], _time_.[[Nanosecond]] - _offsetNanoseconds_). - 1. Perform ? CheckISODaysRange(_balanced_.[[ISODate]]). - 1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_balanced_). + 1. Perform ? CheckISODaysRange(_isoDate_). + 1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_isoDateTime_) - _offsetNanoseconds_. 1. If IsValidEpochNanoseconds(_epochNanoseconds_) is *false*, throw a *RangeError* exception. 1. Return _epochNanoseconds_. 1. Assert: _offsetBehaviour_ is ~option~. From aff933a2ff2962a870d5c38b2eddc1fe26faae74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:44:56 +0200 Subject: [PATCH 02/15] Editorial: Replace BalanceISODateTime with AddOffsetNanosecondsToISODateTime --- spec/plaindatetime.html | 19 ++++++------------- spec/timezone.html | 2 +- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/spec/plaindatetime.html b/spec/plaindatetime.html index 445233518..7205f26c1 100644 --- a/spec/plaindatetime.html +++ b/spec/plaindatetime.html @@ -836,18 +836,11 @@

- +

- BalanceISODateTime ( - _year_: an integer, - _month_: an integer, - _day_: an integer, - _hour_: an integer, - _minute_: an integer, - _second_: an integer, - _millisecond_: an integer, - _microsecond_: an integer, - _nanosecond_: an integer, + AddOffsetNanosecondsToISODateTime ( + _isoDateTime_: an ISO Date-Time Record, + _nanoseconds_: an integer in the interval from -86400 × 109 (exclusive) to 86400 × 109 (exclusive), ): an ISO Date-Time Record

@@ -855,8 +848,8 @@

- 1. Let _balancedTime_ be BalanceTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_). - 1. Let _balancedDate_ be BalanceISODate(_year_, _month_, _day_ + _balancedTime_.[[Days]]). + 1. Let _balancedTime_ be BalanceTime(_isoDateTime_.[[Time]].[[Hour]], _isoDateTime_.[[Time]].[[Minute]], _isoDateTime_.[[Time]].[[Second]], _isoDateTime_.[[Time]].[[Millisecond]], _isoDateTime_.[[Time]].[[Microsecond]], _isoDateTime_.[[Time]].[[Nanosecond]] + _nanoseconds_). + 1. Let _balancedDate_ be BalanceISODate(_isoDateTime_.[[ISODate]].[[Year]], _isoDateTime_.[[ISODate]].[[Month]], _isoDateTime_.[[ISODate]].[[Day]] + _balancedTime_.[[Days]]). 1. Return CombineISODateAndTimeRecord(_balancedDate_, _balancedTime_).
diff --git a/spec/timezone.html b/spec/timezone.html index 50250334f..6e84d7732 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -257,7 +257,7 @@

1. Let _offsetNanoseconds_ be GetOffsetNanosecondsFor(_timeZone_, _epochNs_). 1. Let _result_ be GetISOPartsFromEpoch(ℝ(_epochNs_)). - 1. Return BalanceISODateTime(_result_.[[ISODate]].[[Year]], _result_.[[ISODate]].[[Month]], _result_.[[ISODate]].[[Day]], _result_.[[Time]].[[Hour]], _result_.[[Time]].[[Minute]], _result_.[[Time]].[[Second]], _result_.[[Time]].[[Millisecond]], _result_.[[Time]].[[Microsecond]], _result_.[[Time]].[[Nanosecond]] + _offsetNanoseconds_). + 1. Return AddOffsetNanosecondsToISODateTime(_result_, _offsetNanoseconds_). From 1a837de2196e3b1fa1b773f74b07b0148b15c537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:44:57 +0200 Subject: [PATCH 03/15] Editorial: Replace BalanceISODate with AddDaysToISODate --- spec/calendar.html | 12 ++++++------ spec/duration.html | 4 ++-- spec/plaindate.html | 13 ++++++------- spec/plaindatetime.html | 6 +++--- spec/plainyearmonth.html | 2 +- spec/timezone.html | 4 ++-- spec/zoneddatetime.html | 6 +++--- 7 files changed, 23 insertions(+), 24 deletions(-) diff --git a/spec/calendar.html b/spec/calendar.html index 6516d0fdc..c97d262ed 100644 --- a/spec/calendar.html +++ b/spec/calendar.html @@ -495,8 +495,8 @@

1. If _calendar_ is *"iso8601"*, then 1. Let _intermediate_ be BalanceISOYearMonth(_isoDate_.[[Year]] + _duration_.[[Years]], _isoDate_.[[Month]] + _duration_.[[Months]]). 1. Set _intermediate_ to ? RegulateISODate(_intermediate_.[[Year]], _intermediate_.[[Month]], _isoDate_.[[Day]], _overflow_). - 1. Let _d_ be _intermediate_.[[Day]] + _duration_.[[Days]] + 7 × _duration_.[[Weeks]]. - 1. Let _result_ be BalanceISODate(_intermediate_.[[Year]], _intermediate_.[[Month]], _d_). + 1. Let _days_ be _duration_.[[Days]] + 7 × _duration_.[[Weeks]]. + 1. Let _result_ be AddDaysToISODate(_intermediate_, _days_). 1. Else, 1. Let _result_ be an implementation-defined ISO Date Record, or throw a *RangeError* exception, as described below. 1. If ISODateWithinLimits(_result_) is *false*, throw a *RangeError* exception. @@ -547,18 +547,18 @@

1. Let _weeks_ be 0. 1. If _largestUnit_ is ~week~, then 1. Let _candidateWeeks_ be _sign_. - 1. Set _intermediate_ to BalanceISODate(_constrained_.[[Year]], _constrained_.[[Month]], _constrained_.[[Day]] + 7 × _candidateWeeks_). + 1. Set _intermediate_ to AddDaysToISODate(_constrained_, 7 × _candidateWeeks_). 1. Repeat, while ISODateSurpasses(_sign_, _intermediate_.[[Year]], _intermediate_.[[Month]], _intermediate_.[[Day]], _two_) is *false*, 1. Set _weeks_ to _candidateWeeks_. 1. Set _candidateWeeks_ to _candidateWeeks_ + sign. - 1. Set _intermediate_ to BalanceISODate(_intermediate_.[[Year]], _intermediate_.[[Month]], _intermediate_.[[Day]] + 7 × _sign_). + 1. Set _intermediate_ to AddDaysToISODate(_intermediate_, 7 × _sign_). 1. Let _days_ be 0. 1. Let _candidateDays_ be _sign_. - 1. Set _intermediate_ to BalanceISODate(_constrained_.[[Year]], _constrained_.[[Month]], _constrained_.[[Day]] + 7 × _weeks_ + _candidateDays_). + 1. Set _intermediate_ to AddDaysToISODate(_constrained_, 7 × _weeks_ + _candidateDays_). 1. Repeat, while ISODateSurpasses(_sign_, _intermediate_.[[Year]], _intermediate_.[[Month]], _intermediate_.[[Day]], _two_) is *false*, 1. Set _days_ to _candidateDays_. 1. Set _candidateDays_ to _candidateDays_ + _sign_. - 1. Set _intermediate_ to BalanceISODate(_intermediate_.[[Year]], _intermediate_.[[Month]], _intermediate_.[[Day]] + _sign_). + 1. Set _intermediate_ to AddDaysToISODate(_intermediate_, _sign_). 1. Return ! CreateDateDurationRecord(_years_, _months_, _weeks_, _days_). 1. Return an implementation-defined Date Duration Record as described above. diff --git a/spec/duration.html b/spec/duration.html index d262bd85d..1870415fc 100644 --- a/spec/duration.html +++ b/spec/duration.html @@ -1614,7 +1614,7 @@

1. Else if _unit_ is ~week~, then 1. Let _yearsMonths_ be ! AdjustDateDurationRecord(_duration_.[[Date]], 0, 0). 1. Let _weeksStart_ be ? CalendarDateAdd(_calendar_, _isoDateTime_.[[ISODate]], _yearsMonths_, ~constrain~). - 1. Let _weeksEnd_ be BalanceISODate(_weeksStart_.[[Year]], _weeksStart_.[[Month]], _weeksStart_.[[Day]] + _duration_.[[Date]].[[Days]]). + 1. Let _weeksEnd_ be AddDaysToISODate(_weeksStart_, _duration_.[[Date]].[[Days]]). 1. Let _untilResult_ be CalendarDateUntil(_calendar_, _weeksStart_, _weeksEnd_, ~week~). 1. Let _weeks_ be RoundNumberToIncrement(_duration_.[[Date]].[[Weeks]] + _untilResult_.[[Weeks]], _increment_, ~trunc~). 1. Let _r1_ be _weeks_. @@ -1692,7 +1692,7 @@

1. Let _start_ be ? CalendarDateAdd(_calendar_, _isoDateTime_.[[ISODate]], _duration_.[[Date]], ~constrain~). 1. Let _startDateTime_ be CombineISODateAndTimeRecord(_start_, _isoDateTime_.[[Time]]). - 1. Let _endDate_ be BalanceISODate(_start_.[[Year]], _start_.[[Month]], _start_.[[Day]] + _sign_). + 1. Let _endDate_ be AddDaysToISODate(_start_, _sign_). 1. Let _endDateTime_ be CombineISODateAndTimeRecord(_endDate_, _isoDateTime_.[[Time]]). 1. Let _startEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _startDateTime_, ~compatible~). 1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~). diff --git a/spec/plaindate.html b/spec/plaindate.html index bcb44a636..9f078a1bf 100644 --- a/spec/plaindate.html +++ b/spec/plaindate.html @@ -773,23 +773,22 @@

- +

- BalanceISODate ( - _year_: an integer, - _month_: an integer, - _day_: an integer, + AddDaysToISODate ( + _isoDate_: an ISO Date Record, + _days_: an integer, ): an ISO Date Record

description
- It converts the given _year_, _month_, and _day_ into a valid calendar date in the ISO 8601 calendar as given by IsValidISODate, by overflowing out-of-range _month_ or _day_ values into the next-highest unit. + It adds _days_ to _isoDate_ into a valid calendar date in the ISO 8601 calendar as given by IsValidISODate, by overflowing out-of-range month or day values into the next-highest unit. This date may be outside the range given by ISODateTimeWithinLimits.
- 1. Let _epochDays_ be ISODateToEpochDays(_year_, _month_ - 1, _day_). + 1. Let _epochDays_ be ISODateToEpochDays(_isoDate_.[[Year]], _isoDate_.[[Month]] - 1, _isoDate_.[[Day]]) + _days_. 1. Let _ms_ be EpochDaysToEpochMs(_epochDays_, 0). 1. Return CreateISODateRecord(EpochTimeToEpochYear(_ms_), EpochTimeToMonthInYear(_ms_) + 1, EpochTimeToDate(_ms_)). diff --git a/spec/plaindatetime.html b/spec/plaindatetime.html index 7205f26c1..2603e97ee 100644 --- a/spec/plaindatetime.html +++ b/spec/plaindatetime.html @@ -849,7 +849,7 @@

1. Let _balancedTime_ be BalanceTime(_isoDateTime_.[[Time]].[[Hour]], _isoDateTime_.[[Time]].[[Minute]], _isoDateTime_.[[Time]].[[Second]], _isoDateTime_.[[Time]].[[Millisecond]], _isoDateTime_.[[Time]].[[Microsecond]], _isoDateTime_.[[Time]].[[Nanosecond]] + _nanoseconds_). - 1. Let _balancedDate_ be BalanceISODate(_isoDateTime_.[[ISODate]].[[Year]], _isoDateTime_.[[ISODate]].[[Month]], _isoDateTime_.[[ISODate]].[[Day]] + _balancedTime_.[[Days]]). + 1. Let _balancedDate_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _balancedTime_.[[Days]]). 1. Return CombineISODateAndTimeRecord(_balancedDate_, _balancedTime_). @@ -935,7 +935,7 @@

1. Assert: ISODateTimeWithinLimits(_isoDateTime_) is *true*. 1. Let _roundedTime_ be RoundTime(_isoDateTime_.[[Time]], _increment_, _unit_, _roundingMode_). - 1. Let _balanceResult_ be BalanceISODate(_isoDateTime_.[[ISODate]].[[Year]], _isoDateTime_.[[ISODate]].[[Month]], _isoDateTime_.[[ISODate]].[[Day]] + _roundedTime_.[[Days]]). + 1. Let _balanceResult_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _roundedTime_.[[Days]]). 1. Return CombineISODateAndTimeRecord(_balanceResult_, _roundedTime_). @@ -964,7 +964,7 @@

1. Let _dateSign_ be CompareISODate(_isoDateTime2_.[[ISODate]], _isoDateTime1_.[[ISODate]]). 1. Let _adjustedDate_ be _isoDateTime2_.[[ISODate]]. 1. If _timeSign_ = -_dateSign_, then - 1. Set _adjustedDate_ to BalanceISODate(_adjustedDate_.[[Year]], _adjustedDate_.[[Month]], _adjustedDate_.[[Day]] + _timeSign_). + 1. Set _adjustedDate_ to AddDaysToISODate(_adjustedDate_, _timeSign_). 1. Set _timeDuration_ to ? Add24HourDaysToTimeDuration(_timeDuration_, -_timeSign_). 1. Let _dateLargestUnit_ be LargerOfTwoTemporalUnits(~day~, _largestUnit_). 1. Let _dateDifference_ be CalendarDateUntil(_calendar_, _isoDateTime1_.[[ISODate]], _adjustedDate_, _dateLargestUnit_). diff --git a/spec/plainyearmonth.html b/spec/plainyearmonth.html index 8a602cac7..0c5fb06e8 100644 --- a/spec/plainyearmonth.html +++ b/spec/plainyearmonth.html @@ -648,7 +648,7 @@

1. If _sign_ < 0, then 1. Let _oneMonthDuration_ be ! CreateDateDurationRecord(0, 1, 0, 0). 1. Let _nextMonth_ be ? CalendarDateAdd(_calendar_, _intermediateDate_, _oneMonthDuration_, ~constrain~). - 1. Let _date_ be BalanceISODate(_nextMonth_.[[Year]], _nextMonth_.[[Month]], _nextMonth_.[[Day]] - 1). + 1. Let _date_ be AddDaysToISODate(_nextMonth_, -1). 1. Assert: ISODateWithinLimits(_date_) is *true*. 1. Else, 1. Let _date_ be _intermediateDate_. diff --git a/spec/timezone.html b/spec/timezone.html index 6e84d7732..63612e8cb 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -316,7 +316,7 @@

1. If _disambiguation_ is ~earlier~, then 1. Let _timeDuration_ be TimeDurationFromComponents(0, 0, 0, 0, 0, -_nanoseconds_). 1. Let _earlierTime_ be AddTime(_isoDateTime_.[[Time]], _timeDuration_). - 1. Let _earlierDate_ be BalanceISODate(_isoDateTime_.[[ISODate]].[[Year]], _isoDateTime_.[[ISODate]].[[Month]], _isoDateTime_.[[ISODate]].[[Day]] + _earlierTime_.[[Days]]). + 1. Let _earlierDate_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _earlierTime_.[[Days]]). 1. Let _earlierDateTime_ be CombineISODateAndTimeRecord(_earlierDate_, _earlierTime_). 1. Set _possibleEpochNs_ to ? GetPossibleEpochNanoseconds(_timeZone_, _earlierDateTime_). 1. Assert: _possibleEpochNs_ is not empty. @@ -324,7 +324,7 @@

1. Assert: _disambiguation_ is ~compatible~ or ~later~. 1. Let _timeDuration_ be TimeDurationFromComponents(0, 0, 0, 0, 0, _nanoseconds_). 1. Let _laterTime_ be AddTime(_isoDateTime_.[[Time]], _timeDuration_). - 1. Let _laterDate_ be BalanceISODate(_isoDateTime_.[[ISODate]].[[Year]], _isoDateTime_.[[ISODate]].[[Month]], _isoDateTime_.[[ISODate]].[[Day]] + _laterTime_.[[Days]]). + 1. Let _laterDate_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _laterTime_.[[Days]]). 1. Let _laterDateTime_ be CombineISODateAndTimeRecord(_laterDate_, _laterTime_). 1. Set _possibleEpochNs_ to ? GetPossibleEpochNanoseconds(_timeZone_, _laterDateTime_). 1. Set _n_ to _possibleEpochNs_'s length. diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index ef444cb6d..9fe78266c 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -398,7 +398,7 @@

get Temporal.ZonedDateTime.prototype.hoursInDay

1. Let _timeZone_ be _zonedDateTime_.[[TimeZone]]. 1. Let _isoDateTime_ be GetISODateTimeFor(_timeZone_, _zonedDateTime_.[[EpochNanoseconds]]). 1. Let _today_ be _isoDateTime_.[[ISODate]]. - 1. Let _tomorrow_ be BalanceISODate(_today_.[[Year]], _today_.[[Month]], _today_.[[Day]] + 1). + 1. Let _tomorrow_ be AddDaysToISODate(_today_, 1). 1. Let _todayNs_ be ? GetStartOfDay(_timeZone_, _today_). 1. Let _tomorrowNs_ be ? GetStartOfDay(_timeZone_, _tomorrow_). 1. Let _diff_ be TimeDurationFromEpochNanosecondsDifference(_tomorrowNs_, _todayNs_). @@ -651,7 +651,7 @@

Temporal.ZonedDateTime.prototype.round ( _roundTo_ )

1. Let _isoDateTime_ be GetISODateTimeFor(_timeZone_, _thisNs_). 1. If _smallestUnit_ is ~day~, then 1. Let _dateStart_ be _isoDateTime_.[[ISODate]]. - 1. Let _dateEnd_ be BalanceISODate(_dateStart_.[[Year]], _dateStart_.[[Month]], _dateStart_.[[Day]] + 1). + 1. Let _dateEnd_ be AddDaysToISODate(_dateStart_, 1). 1. Let _startNs_ be ? GetStartOfDay(_timeZone_, _dateStart_). 1. Assert: _thisNs_ ≥ _startNs_. 1. Let _endNs_ be ? GetStartOfDay(_timeZone_, _dateEnd_). @@ -1127,7 +1127,7 @@

1. If TimeDurationSign(_timeDuration_) = -_sign_, set _dayCorrection_ to _dayCorrection_ + 1. 1. Let _success_ be *false*. 1. Repeat, while _dayCorrection_ ≤ _maxDayCorrection_ and _success_ is *false*, - 1. Let _intermediateDate_ be BalanceISODate(_endDateTime_.[[ISODate]].[[Year]], _endDateTime_.[[ISODate]].[[Month]], _endDateTime_.[[ISODate]].[[Day]] - _dayCorrection_ × _sign_). + 1. Let _intermediateDate_ be AddDaysToISODate(_endDateTime_.[[ISODate]], _dayCorrection_ × -_sign_). 1. Let _intermediateDateTime_ be CombineISODateAndTimeRecord(_intermediateDate_, _startDateTime_.[[Time]]). 1. Let _intermediateNs_ be ? GetEpochNanosecondsFor(_timeZone_, _intermediateDateTime_, ~compatible~). 1. Set _timeDuration_ to TimeDurationFromEpochNanosecondsDifference(_ns2_, _intermediateNs_). From ef8fadae2b4e81026f89f3e997f79c63efecad97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:44:57 +0200 Subject: [PATCH 04/15] Editorial: Switch +1/-1 to avoid negating sign --- spec/zoneddatetime.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index 9fe78266c..123d64636 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -1120,19 +1120,19 @@

1. If _ns1_ = _ns2_, return ! CombineDateAndTimeDuration(ZeroDateDuration(), 0). 1. Let _startDateTime_ be GetISODateTimeFor(_timeZone_, _ns1_). 1. Let _endDateTime_ be GetISODateTimeFor(_timeZone_, _ns2_). - 1. If _ns2_ - _ns1_ < 0, let _sign_ be -1; else let _sign_ be 1. - 1. If _sign_ = 1, let _maxDayCorrection_ be 2; else let _maxDayCorrection_ be 1. + 1. If _ns2_ - _ns1_ < 0, let _sign_ be 1; else let _sign_ be -1. + 1. If _sign_ = -1, let _maxDayCorrection_ be 2; else let _maxDayCorrection_ be 1. 1. Let _dayCorrection_ be 0. 1. Let _timeDuration_ be DifferenceTime(_startDateTime_.[[Time]], _endDateTime_.[[Time]]). - 1. If TimeDurationSign(_timeDuration_) = -_sign_, set _dayCorrection_ to _dayCorrection_ + 1. + 1. If TimeDurationSign(_timeDuration_) = _sign_, set _dayCorrection_ to _dayCorrection_ + 1. 1. Let _success_ be *false*. 1. Repeat, while _dayCorrection_ ≤ _maxDayCorrection_ and _success_ is *false*, - 1. Let _intermediateDate_ be AddDaysToISODate(_endDateTime_.[[ISODate]], _dayCorrection_ × -_sign_). + 1. Let _intermediateDate_ be AddDaysToISODate(_endDateTime_.[[ISODate]], _dayCorrection_ × _sign_). 1. Let _intermediateDateTime_ be CombineISODateAndTimeRecord(_intermediateDate_, _startDateTime_.[[Time]]). 1. Let _intermediateNs_ be ? GetEpochNanosecondsFor(_timeZone_, _intermediateDateTime_, ~compatible~). 1. Set _timeDuration_ to TimeDurationFromEpochNanosecondsDifference(_ns2_, _intermediateNs_). 1. Let _timeSign_ be TimeDurationSign(_timeDuration_). - 1. If _sign_ ≠ -_timeSign_, then + 1. If _sign_ ≠ _timeSign_, then 1. Set _success_ to *true*. 1. Set _dayCorrection_ to _dayCorrection_ + 1. 1. Assert: _success_ is *true*. From 6b12d09cae10f8fefe21828121620d6cac07cd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:44:58 +0200 Subject: [PATCH 05/15] Editorial: Move CheckISODaysRange to the top --- spec/timezone.html | 3 +-- spec/zoneddatetime.html | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/timezone.html b/spec/timezone.html index 63612e8cb..3668a0489 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -347,14 +347,13 @@

+ 1. Perform ? CheckISODaysRange(_isoDateTime_.[[ISODate]]). 1. Let _parseResult_ be ! ParseTimeZoneIdentifier(_timeZone_). 1. If _parseResult_.[[OffsetMinutes]] is not ~empty~, then 1. Let _offsetNanoseconds_ be _parseResult_.[[OffsetMinutes]] × 6 × 1010. - 1. Perform ? CheckISODaysRange(_isoDateTime_.[[ISODate]]). 1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_isoDateTime_) - _offsetNanoseconds_. 1. Let _possibleEpochNanoseconds_ be « _epochNanoseconds_ ». 1. Else, - 1. Perform ? CheckISODaysRange(_isoDateTime_.[[ISODate]]). 1. Let _possibleEpochNanoseconds_ be GetNamedTimeZoneEpochNanoseconds(_parseResult_.[[Name]], _isoDateTime_). 1. For each value _epochNanoseconds_ in _possibleEpochNanoseconds_, do 1. If IsValidEpochNanoseconds(_epochNanoseconds_) is *false*, throw a *RangeError* exception. diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index 123d64636..5c9b4122d 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -907,6 +907,7 @@

+ 1. Perform ? CheckISODaysRange(_isoDate_). 1. If _time_ is ~start-of-day~, then 1. Assert: _offsetBehaviour_ is ~wall~. 1. Assert: _offsetNanoseconds_ is 0. @@ -915,13 +916,11 @@

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 - 1. Perform ? CheckISODaysRange(_isoDate_). 1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_isoDateTime_) - _offsetNanoseconds_. 1. If IsValidEpochNanoseconds(_epochNanoseconds_) is *false*, throw a *RangeError* exception. 1. Return _epochNanoseconds_. 1. Assert: _offsetBehaviour_ is ~option~. 1. Assert: _offsetOption_ is ~prefer~ or ~reject~. - 1. Perform ? CheckISODaysRange(_isoDate_). 1. Let _utcEpochNanoseconds_ be GetUTCEpochNanoseconds(_isoDateTime_). 1. Let _possibleEpochNs_ be ? GetPossibleEpochNanoseconds(_timeZone_, _isoDateTime_). 1. For each element _candidate_ of _possibleEpochNs_, do From 4d931394f4f803949d56c163cec555557221f022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:44:58 +0200 Subject: [PATCH 06/15] Editorial: Define CheckISODaysRange in terms of ISODateTimeWithinLimits --- spec/abstractops.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/abstractops.html b/spec/abstractops.html index 09ea49f1d..e351a7ff6 100644 --- a/spec/abstractops.html +++ b/spec/abstractops.html @@ -119,13 +119,13 @@

It checks that the given date is within the range of 108 days from the epoch.
- 1. If abs(ISODateToEpochDays(_isoDate_.[[Year]], _isoDate_.[[Month]] - 1, _isoDate_.[[Day]])) > 108, then + 1. Let _dateTime_ be CombineISODateAndTimeRecord(_isoDate_, MidnightTimeRecord()). + 1. If ISODateTimeWithinLimits(_dateTime_) 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. - It is distinct from ISODateWithinLimits, which uses GetUTCEpochNanoseconds. This operation can be removed with no observable effect when https://github.com/tc39/ecma262/issues/1087 is fixed. From 6322fd98dd4d5e90cc8fa7346592a68847739d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:44:58 +0200 Subject: [PATCH 07/15] Editorial: Pass ISO Date-Time Record to InterpretISODateTimeOffset --- spec/abstractops.html | 16 +++++++++++----- spec/zoneddatetime.html | 25 +++++++++++-------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/spec/abstractops.html b/spec/abstractops.html index e351a7ff6..bbfadab86 100644 --- a/spec/abstractops.html +++ b/spec/abstractops.html @@ -624,13 +624,11 @@

1. Return the Record { [[PlainRelativeTo]]: _plainDate_, [[ZonedRelativeTo]]: *undefined* }. 1. Let _calendar_ be ? GetTemporalCalendarIdentifierWithISODefault(_value_). 1. Let _fields_ be ? PrepareCalendarFields(_calendar_, _value_, « ~year~, ~month~, ~month-code~, ~day~ », « ~hour~, ~minute~, ~second~, ~millisecond~, ~microsecond~, ~nanosecond~, ~offset~, ~time-zone~ », «»). - 1. Let _result_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, ~constrain~). + 1. Let _isoDateTime_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, ~constrain~). 1. Let _timeZone_ be _fields_.[[TimeZone]]. 1. Let _offsetString_ be _fields_.[[Offset]]. 1. If _offsetString_ is ~unset~, then 1. Set _offsetBehaviour_ to ~wall~. - 1. Let _isoDate_ be _result_.[[ISODate]]. - 1. Let _time_ be _result_.[[Time]]. 1. Else, 1. If _value_ is not a String, throw a *TypeError* exception. 1. Let _result_ be ? ParseISODateTime(_value_, « |TemporalDateTimeString[+Zoned]|, |TemporalDateTimeString[~Zoned]| »). @@ -650,14 +648,22 @@

1. Set _calendar_ to ? CanonicalizeCalendar(_calendar_). 1. Let _isoDate_ be CreateISODateRecord(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]). 1. Let _time_ be _result_.[[Time]]. + 1. If _time_ is ~start-of-day~, then + 1. If _timeZone_ is not ~unset~, then + 1. Assert: _offsetBehaviour_ is ~wall~. + 1. Let _epochNanoseconds_ be ? GetStartOfDay(_timeZone_, _isoDate_). + 1. Let _zonedRelativeTo_ be ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZone_, _calendar_). + 1. Return the Record { [[PlainRelativeTo]]: *undefined*, [[ZonedRelativeTo]]: _zonedRelativeTo_ }. + 1. Set _time_ to MidnightTimeRecord(). + 1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, _time_). 1. If _timeZone_ is ~unset~, then - 1. Let _plainDate_ be ? CreateTemporalDate(_isoDate_, _calendar_). + 1. Let _plainDate_ be ? CreateTemporalDate(_isoDateTime_.[[ISODate]], _calendar_). 1. Return the Record { [[PlainRelativeTo]]: _plainDate_, [[ZonedRelativeTo]]: *undefined* }. 1. If _offsetBehaviour_ is ~option~, then 1. Let _offsetNs_ be ! ParseDateTimeUTCOffset(_offsetString_). 1. Else, 1. Let _offsetNs_ be 0. - 1. Let _epochNanoseconds_ be ? InterpretISODateTimeOffset(_isoDate_, _time_, _offsetBehaviour_, _offsetNs_, _timeZone_, ~compatible~, ~reject~, _matchBehaviour_). + 1. Let _epochNanoseconds_ be ? InterpretISODateTimeOffset(_isoDateTime_, _offsetBehaviour_, _offsetNs_, _timeZone_, ~compatible~, ~reject~, _matchBehaviour_). 1. Let _zonedRelativeTo_ be ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZone_, _calendar_). 1. Return the Record { [[PlainRelativeTo]]: *undefined*, [[ZonedRelativeTo]]: _zonedRelativeTo_ }. diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index 5c9b4122d..ed9551e59 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -531,7 +531,7 @@

Temporal.ZonedDateTime.prototype.with ( _temporalZonedDateTimeLike_ [ , _opt 1. Let _overflow_ be ? GetTemporalOverflowOption(_resolvedOptions_). 1. Let _dateTimeResult_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _overflow_). 1. Let _newOffsetNanoseconds_ be ! ParseDateTimeUTCOffset(_fields_.[[OffsetString]]). - 1. Let _epochNanoseconds_ be ? InterpretISODateTimeOffset(_dateTimeResult_.[[ISODate]], _dateTimeResult_.[[Time]], ~option~, _newOffsetNanoseconds_, _timeZone_, _disambiguation_, _offset_, ~match-exactly~). + 1. Let _epochNanoseconds_ be ? InterpretISODateTimeOffset(_dateTimeResult_, ~option~, _newOffsetNanoseconds_, _timeZone_, _disambiguation_, _offset_, ~match-exactly~). 1. Return ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZone_, _calendar_). @@ -663,7 +663,7 @@

Temporal.ZonedDateTime.prototype.round ( _roundTo_ )

1. Else, 1. Let _roundResult_ be RoundISODateTime(_isoDateTime_, _roundingIncrement_, _smallestUnit_, _roundingMode_). 1. Let _offsetNanoseconds_ be GetOffsetNanosecondsFor(_timeZone_, _thisNs_). - 1. Let _epochNanoseconds_ be ? InterpretISODateTimeOffset(_roundResult_.[[ISODate]], _roundResult_.[[Time]], ~option~, _offsetNanoseconds_, _timeZone_, ~compatible~, ~prefer~, ~match-exactly~). + 1. Let _epochNanoseconds_ be ? InterpretISODateTimeOffset(_roundResult_, ~option~, _offsetNanoseconds_, _timeZone_, ~compatible~, ~prefer~, ~match-exactly~). 1. Return ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZone_, _calendar_). @@ -883,8 +883,7 @@

Abstract Operations

InterpretISODateTimeOffset ( - _isoDate_: an ISO Date Record, - _time_: a Time Record or ~start-of-day~, + _isoDateTime_: an ISO Date-Time Record, _offsetBehaviour_: ~option~, ~exact~, or ~wall~, _offsetNanoseconds_: an integer, _timeZone_: an available time zone identifier, @@ -907,12 +906,7 @@

- 1. Perform ? CheckISODaysRange(_isoDate_). - 1. If _time_ is ~start-of-day~, then - 1. Assert: _offsetBehaviour_ is ~wall~. - 1. Assert: _offsetNanoseconds_ is 0. - 1. Return ? GetStartOfDay(_timeZone_, _isoDate_). - 1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, _time_). + 1. Perform ? CheckISODaysRange(_isoDateTime_.[[ISODate]]). 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 @@ -971,9 +965,7 @@

1. Let _disambiguation_ be ? GetTemporalDisambiguationOption(_resolvedOptions_). 1. Let _offsetOption_ be ? GetTemporalOffsetOption(_resolvedOptions_, ~reject~). 1. Let _overflow_ be ? GetTemporalOverflowOption(_resolvedOptions_). - 1. Let _result_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _overflow_). - 1. Let _isoDate_ be _result_.[[ISODate]]. - 1. Let _time_ be _result_.[[Time]]. + 1. Let _isoDateTime_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _overflow_). 1. Else, 1. If _item_ is not a String, throw a *TypeError* exception. 1. Let _result_ be ? ParseISODateTime(_item_, « |TemporalDateTimeString[+Zoned]| »). @@ -995,10 +987,15 @@

1. Perform ? GetTemporalOverflowOption(_resolvedOptions_). 1. Let _isoDate_ be CreateISODateRecord(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]). 1. Let _time_ be _result_.[[Time]]. + 1. If _time_ is ~start-of-day~, then + 1. Assert: _offsetBehaviour_ is ~wall~. + 1. Let _epochNanoseconds_ be ? GetStartOfDay(_timeZone_, _isoDate_). + 1. Return ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZone_, _calendar_). + 1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, _time_). 1. Let _offsetNanoseconds_ be 0. 1. If _offsetBehaviour_ is ~option~, then 1. Set _offsetNanoseconds_ to ! ParseDateTimeUTCOffset(_offsetString_). - 1. Let _epochNanoseconds_ be ? InterpretISODateTimeOffset(_isoDate_, _time_, _offsetBehaviour_, _offsetNanoseconds_, _timeZone_, _disambiguation_, _offsetOption_, _matchBehaviour_). + 1. Let _epochNanoseconds_ be ? InterpretISODateTimeOffset(_isoDateTime_, _offsetBehaviour_, _offsetNanoseconds_, _timeZone_, _disambiguation_, _offsetOption_, _matchBehaviour_). 1. Return ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZone_, _calendar_). From 656cf9052ad160275398fc260c47be4ac645fcb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:44:59 +0200 Subject: [PATCH 08/15] Editorial: Pass ISO Date-Time Record to CheckISODaysRange --- spec/abstractops.html | 7 +++---- spec/instant.html | 2 +- spec/timezone.html | 2 +- spec/zoneddatetime.html | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/spec/abstractops.html b/spec/abstractops.html index bbfadab86..acbeb7574 100644 --- a/spec/abstractops.html +++ b/spec/abstractops.html @@ -111,16 +111,15 @@

Date Equations

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

description
-
It checks that the given date is within the range of 108 days from the epoch.
+
It checks that the given date-time is within the range of 108 days from the epoch.
- 1. Let _dateTime_ be CombineISODateAndTimeRecord(_isoDate_, MidnightTimeRecord()). - 1. If ISODateTimeWithinLimits(_dateTime_) is *false*, then + 1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, then 1. Throw a *RangeError* exception. 1. Return ~unused~. diff --git a/spec/instant.html b/spec/instant.html index 635686b7f..5640528b7 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(_isoDate_). + 1. Perform ? CheckISODaysRange(_isoDateTime_). 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/timezone.html b/spec/timezone.html index 3668a0489..be9d6af02 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -347,7 +347,7 @@

- 1. Perform ? CheckISODaysRange(_isoDateTime_.[[ISODate]]). + 1. Perform ? CheckISODaysRange(_isoDateTime_). 1. Let _parseResult_ be ! ParseTimeZoneIdentifier(_timeZone_). 1. If _parseResult_.[[OffsetMinutes]] is not ~empty~, then 1. Let _offsetNanoseconds_ be _parseResult_.[[OffsetMinutes]] × 6 × 1010. diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index ed9551e59..d133ea66c 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -906,7 +906,7 @@

- 1. Perform ? CheckISODaysRange(_isoDateTime_.[[ISODate]]). + 1. Perform ? CheckISODaysRange(_isoDateTime_). 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 From c8934a7408bfc827fa7490b5e868ec71589861b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:44:59 +0200 Subject: [PATCH 09/15] Editorial: Assert ISO date-time is within limits in DisambiguatePossibleEpochNanoseconds --- spec/timezone.html | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/timezone.html b/spec/timezone.html index be9d6af02..6978246b3 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -294,6 +294,7 @@

It chooses from a List of possible exact times the one indicated by the _disambiguation_ parameter.
+ 1. Assert: ISODateTimeWithinLimits(_isoDateTime_) is *true*. 1. Let _n_ be _possibleEpochNs_'s length. 1. If _n_ = 1, then 1. Return _possibleEpochNs_[0]. From 07b9476b51e6ad6b812d7a8b7cf52315c08cb7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:44:59 +0200 Subject: [PATCH 10/15] Editorial: Add assertion that epoch nanoseconds are valid --- spec/timezone.html | 1 + spec/zoneddatetime.html | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/spec/timezone.html b/spec/timezone.html index 6978246b3..ed82d107f 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -255,6 +255,7 @@

+ 1. Assert: IsValidEpochNanoseconds(_epochNs_) is *true*. 1. Let _offsetNanoseconds_ be GetOffsetNanosecondsFor(_timeZone_, _epochNs_). 1. Let _result_ be GetISOPartsFromEpoch(ℝ(_epochNs_)). 1. Return AddOffsetNanosecondsToISODateTime(_result_, _offsetNanoseconds_). diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index d133ea66c..3d1b7bf9f 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -1085,6 +1085,7 @@

+ 1. Assert: IsValidEpochNanoseconds(_epochNanoseconds_) is *true*. 1. If DateDurationSign(_duration_.[[Date]]) = 0, then 1. Return ? AddInstant(_epochNanoseconds_, _duration_.[[Time]]). 1. Let _isoDateTime_ be GetISODateTimeFor(_timeZone_, _epochNanoseconds_). @@ -1113,6 +1114,8 @@

+ 1. Assert: IsValidEpochNanoseconds(_ns1_) is *true*. + 1. Assert: IsValidEpochNanoseconds(_ns2_) is *true*. 1. If _ns1_ = _ns2_, return ! CombineDateAndTimeDuration(ZeroDateDuration(), 0). 1. Let _startDateTime_ be GetISODateTimeFor(_timeZone_, _ns1_). 1. Let _endDateTime_ be GetISODateTimeFor(_timeZone_, _ns2_). @@ -1156,6 +1159,8 @@

+ 1. Assert: IsValidEpochNanoseconds(_ns1_) is *true*. + 1. Assert: IsValidEpochNanoseconds(_ns2_) is *true*. 1. If TemporalUnitCategory(_largestUnit_) is ~time~, then 1. Return DifferenceInstant(_ns1_, _ns2_, _roundingIncrement_, _smallestUnit_, _roundingMode_). 1. Let _difference_ be ? DifferenceZonedDateTime(_ns1_, _ns2_, _timeZone_, _calendar_, _largestUnit_). @@ -1180,6 +1185,8 @@

+ 1. Assert: IsValidEpochNanoseconds(_ns1_) is *true*. + 1. Assert: IsValidEpochNanoseconds(_ns2_) is *true*. 1. If TemporalUnitCategory(_unit_) is ~time~, then 1. Let _difference_ be TimeDurationFromEpochNanosecondsDifference(_ns2_, _ns1_). 1. Return TotalTimeDuration(_difference_, _unit_). From f2478d9fd6bf5d151aa8b7c7599f5349caf9c3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:45:00 +0200 Subject: [PATCH 11/15] Editorial: Move CheckISODaysRange from GetPossibleEpochNanoseconds to callers --- spec/timezone.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/timezone.html b/spec/timezone.html index ed82d107f..407dd185f 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -276,6 +276,7 @@

+ 1. Perform ? CheckISODaysRange(_isoDateTime_). 1. Let _possibleEpochNs_ be ? GetPossibleEpochNanoseconds(_timeZone_, _isoDateTime_). 1. Return ? DisambiguatePossibleEpochNanoseconds(_possibleEpochNs_, _timeZone_, _isoDateTime_, _disambiguation_). @@ -320,6 +321,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. Set _possibleEpochNs_ to ? GetPossibleEpochNanoseconds(_timeZone_, _earlierDateTime_). 1. Assert: _possibleEpochNs_ is not empty. 1. Return _possibleEpochNs_[0]. @@ -328,6 +330,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. Set _possibleEpochNs_ to ? GetPossibleEpochNanoseconds(_timeZone_, _laterDateTime_). 1. Set _n_ to _possibleEpochNs_'s length. 1. Assert: _n_ ≠ 0. @@ -349,7 +352,7 @@

- 1. Perform ? CheckISODaysRange(_isoDateTime_). + 1. Assert: ISODateTimeWithinLimits(_isoDateTime_) is *true*. 1. Let _parseResult_ be ! ParseTimeZoneIdentifier(_timeZone_). 1. If _parseResult_.[[OffsetMinutes]] is not ~empty~, then 1. Let _offsetNanoseconds_ be _parseResult_.[[OffsetMinutes]] × 6 × 1010. @@ -376,6 +379,7 @@

1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, MidnightTimeRecord()). + 1. Perform ? CheckISODaysRange(_isoDateTime_). 1. Let _possibleEpochNs_ be ? GetPossibleEpochNanoseconds(_timeZone_, _isoDateTime_). 1. If _possibleEpochNs_ is not empty, return _possibleEpochNs_[0]. 1. Assert: IsOffsetTimeZoneIdentifier(_timeZone_) is *false*. From f95ddf9aaf952e00d7c3f5152369bea677f88d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:45:00 +0200 Subject: [PATCH 12/15] Editorial: Move CheckISODaysRange from GetEpochNanosecondsFor to callers --- spec/duration.html | 5 +++++ spec/timezone.html | 2 +- spec/zoneddatetime.html | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/duration.html b/spec/duration.html index 1870415fc..07ea59acc 100644 --- a/spec/duration.html +++ b/spec/duration.html @@ -1638,6 +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. Let _startEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _startDateTime_, ~compatible~). 1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~). 1. If _sign_ is 1, then @@ -1692,8 +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. Let _endDate_ be AddDaysToISODate(_start_, _sign_). 1. Let _endDateTime_ be CombineISODateAndTimeRecord(_endDate_, _isoDateTime_.[[Time]]). + 1. Perform ? CheckISODaysRange(_endDateTime_). 1. Let _startEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _startDateTime_, ~compatible~). 1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~). 1. Let _daySpan_ be TimeDurationFromEpochNanosecondsDifference(_endEpochNs_, _startEpochNs_). @@ -1798,6 +1802,7 @@

1. If _timeZone_ is ~unset~, then 1. Let _endEpochNs_ be GetUTCEpochNanoseconds(_endDateTime_). 1. Else, + 1. Perform ? CheckISODaysRange(_endDateTime_). 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/timezone.html b/spec/timezone.html index 407dd185f..6e1ff26cd 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -276,7 +276,7 @@

- 1. Perform ? CheckISODaysRange(_isoDateTime_). + 1. Assert: ISODateTimeWithinLimits(_isoDateTime_) is *true*. 1. Let _possibleEpochNs_ be ? GetPossibleEpochNanoseconds(_timeZone_, _isoDateTime_). 1. Return ? DisambiguatePossibleEpochNanoseconds(_possibleEpochNs_, _timeZone_, _isoDateTime_, _disambiguation_). diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index 3d1b7bf9f..f6b02d3b1 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -550,6 +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. Let _epochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _resultISODateTime_, ~compatible~). 1. Return ! CreateTemporalZonedDateTime(_epochNs_, _timeZone_, _calendar_).
@@ -1128,6 +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. Let _intermediateNs_ be ? GetEpochNanosecondsFor(_timeZone_, _intermediateDateTime_, ~compatible~). 1. Set _timeDuration_ to TimeDurationFromEpochNanosecondsDifference(_ns2_, _intermediateNs_). 1. Let _timeSign_ be TimeDurationSign(_timeDuration_). From bd4c0d42dc4d47d0bad0f7daa87f24a864ba395b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:45:01 +0200 Subject: [PATCH 13/15] Editorial: Inline AddOffsetNanosecondsToISODateTime into GetISODateTimeFor --- spec/plaindatetime.html | 18 ------------------ spec/timezone.html | 6 ++++-- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/spec/plaindatetime.html b/spec/plaindatetime.html index 2603e97ee..57692b1b4 100644 --- a/spec/plaindatetime.html +++ b/spec/plaindatetime.html @@ -836,24 +836,6 @@

- -

- AddOffsetNanosecondsToISODateTime ( - _isoDateTime_: an ISO Date-Time Record, - _nanoseconds_: an integer in the interval from -86400 × 109 (exclusive) to 86400 × 109 (exclusive), - ): an ISO Date-Time Record -

-
-
description
-
-
- - 1. Let _balancedTime_ be BalanceTime(_isoDateTime_.[[Time]].[[Hour]], _isoDateTime_.[[Time]].[[Minute]], _isoDateTime_.[[Time]].[[Second]], _isoDateTime_.[[Time]].[[Millisecond]], _isoDateTime_.[[Time]].[[Microsecond]], _isoDateTime_.[[Time]].[[Nanosecond]] + _nanoseconds_). - 1. Let _balancedDate_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _balancedTime_.[[Days]]). - 1. Return CombineISODateAndTimeRecord(_balancedDate_, _balancedTime_). - -
-

CreateTemporalDateTime ( diff --git a/spec/timezone.html b/spec/timezone.html index 6e1ff26cd..288cc1b15 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -257,8 +257,10 @@

1. Assert: IsValidEpochNanoseconds(_epochNs_) is *true*. 1. Let _offsetNanoseconds_ be GetOffsetNanosecondsFor(_timeZone_, _epochNs_). - 1. Let _result_ be GetISOPartsFromEpoch(ℝ(_epochNs_)). - 1. Return AddOffsetNanosecondsToISODateTime(_result_, _offsetNanoseconds_). + 1. Let _isoDateTime_ be GetISOPartsFromEpoch(ℝ(_epochNs_)). + 1. Let _balancedTime_ be BalanceTime(_isoDateTime_.[[Time]].[[Hour]], _isoDateTime_.[[Time]].[[Minute]], _isoDateTime_.[[Time]].[[Second]], _isoDateTime_.[[Time]].[[Millisecond]], _isoDateTime_.[[Time]].[[Microsecond]], _isoDateTime_.[[Time]].[[Nanosecond]] + _offsetNanoseconds_). + 1. Let _balancedDate_ be AddDaysToISODate(_isoDateTime_.[[ISODate]], _balancedTime_.[[Days]]). + 1. Return CombineISODateAndTimeRecord(_balancedDate_, _balancedTime_). From bf858df5e6e22083c0f74b78d1d8829a0a25fdbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 17 Oct 2024 18:45:01 +0200 Subject: [PATCH 14/15] Editorial: Replace ISODateTimeWithinLimits with CheckISODaysRange before GetEpochNanosecondsFor --- spec/plaindate.html | 2 +- spec/zoneddatetime.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/plaindate.html b/spec/plaindate.html index 9f078a1bf..aab7011eb 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. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception. + 1. Perform ? CheckISODaysRange(_isoDateTime_). 1. Let _epochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _isoDateTime_, ~compatible~). 1. Return ! CreateTemporalZonedDateTime(_epochNs_, _timeZone_, _temporalDate_.[[Calendar]]). diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index f6b02d3b1..1d6ce6c8c 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -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. If ISODateTimeWithinLimits(_intermediateDateTime_) is *false*, throw a *RangeError* exception. + 1. Perform ? CheckISODaysRange(_intermediateDateTime_). 1. Let _intermediateNs_ be ! GetEpochNanosecondsFor(_timeZone_, _intermediateDateTime_, ~compatible~). 1. Return ? AddInstant(_intermediateNs_, _duration_.[[Time]]). 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 15/15] 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_).