diff --git a/spec/abstractops.html b/spec/abstractops.html index aaf66b2a5e..21438fa712 100644 --- a/spec/abstractops.html +++ b/spec/abstractops.html @@ -183,14 +183,14 @@

Units

*"hour"* *"hours"* ~time~ - 3.6 × 1012 + 3.6 × 1012 *"minute"* *"minutes"* ~time~ - 6 × 1010 + 6 × 1010 @@ -587,7 +587,7 @@

1. Assert: _dividend_ > 1. 1. Let _maximum_ be _dividend_ - 1. 1. If _increment_ > _maximum_, throw a *RangeError* exception. - 1. If _dividend_ modulo _increment_ ≠ 0, then + 1. If _dividend_ modulo _increment_ ≠ 0, then 1. Throw a *RangeError* exception. 1. Return ~unused~. @@ -609,7 +609,7 @@

1. If _digitsValue_ is not a Number, then 1. If ? ToString(_digitsValue_) is not *"auto"*, throw a *RangeError* exception. 1. Return *"auto"*. - 1. If _digitsValue_ is *NaN*, *+∞*𝔽, or *-∞*𝔽, throw a *RangeError* exception. + 1. If _digitsValue_ is *NaN*, *+∞*𝔽, or *-∞*𝔽, throw a *RangeError* exception. 1. Let _digitCount_ be floor(ℝ(_digitsValue_)). 1. If _digitCount_ < 0 or _digitCount_ > 9, throw a *RangeError* exception. 1. Return _digitCount_. @@ -1124,7 +1124,7 @@

1. Let _r2_ be the smallest integer such that _r2_ > _quotient_. 1. Let _rounded_ be ApplyUnsignedRoundingMode(_quotient_, _r1_, _r2_, _unsignedRoundingMode_). 1. If _isNegative_ is ~negative~, set _rounded_ to -_rounded_. - 1. Return _rounded_ × _increment_. + 1. Return _rounded_ × _increment_. @@ -1147,10 +1147,10 @@

1. Let _quotient_ be _x_ / _increment_. 1. Let _unsignedRoundingMode_ be GetUnsignedRoundingMode(_roundingMode_, ~positive~). - 1. Let _r1_ be the largest integer such that _r1_ ≤ _quotient_. + 1. Let _r1_ be the largest integer such that _r1_ ≤ _quotient_. 1. Let _r2_ be the smallest integer such that _r2_ > _quotient_. 1. Let _rounded_ be ApplyUnsignedRoundingMode(_quotient_, _r1_, _r2_, _unsignedRoundingMode_). - 1. Return _rounded_ × _increment_. + 1. Return _rounded_ × _increment_. @@ -1606,7 +1606,7 @@

1. Let _parseResult_ be ~empty~. 1. Let _calendar_ be ~empty~. - 1. For each nonterminal _goal_ of « |TemporalDateTimeString|, |TemporalInstantString|, |TemporalTimeString|, |TemporalMonthDayString|, |TemporalYearMonthString| », do + 1. For each nonterminal _goal_ of « |TemporalDateTimeString|, |TemporalInstantString|, |TemporalTimeString|, |TemporalMonthDayString|, |TemporalYearMonthString| », do 1. If _parseResult_ is not a Parse Node, then 1. Set _parseResult_ to ParseText(StringToCodePoints(_isoString_), _goal_). 1. If _parseResult_ is a Parse Node, then @@ -1832,40 +1832,40 @@

1. Assert: _minutes_, _fMinutes_, _seconds_, and _fSeconds_ are empty. 1. Let _fHoursDigits_ be the substring of CodePointsToString(_fHours_) from 1. 1. Let _fHoursScale_ be the length of _fHoursDigits_. - 1. Let _minutesMV_ be ? ToIntegerWithTruncation(_fHoursDigits_) / 10_fHoursScale_ × 60. + 1. Let _minutesMV_ be ? ToIntegerWithTruncation(_fHoursDigits_) / 10_fHoursScale_ × 60. 1. Else, 1. Let _minutesMV_ be ? ToIntegerWithTruncation(CodePointsToString(_minutes_)). 1. If _fMinutes_ is not empty, then 1. Assert: _seconds_ and _fSeconds_ are empty. 1. Let _fMinutesDigits_ be the substring of CodePointsToString(_fMinutes_) from 1. 1. Let _fMinutesScale_ be the length of _fMinutesDigits_. - 1. Let _secondsMV_ be ? ToIntegerWithTruncation(_fMinutesDigits_) / 10_fMinutesScale_ × 60. + 1. Let _secondsMV_ be ? ToIntegerWithTruncation(_fMinutesDigits_) / 10_fMinutesScale_ × 60. 1. Else if _seconds_ is not empty, then 1. Let _secondsMV_ be ? ToIntegerWithTruncation(CodePointsToString(_seconds_)). 1. Else, - 1. Let _secondsMV_ be remainder(_minutesMV_, 1) × 60. + 1. Let _secondsMV_ be remainder(_minutesMV_, 1) × 60. 1. If _fSeconds_ is not empty, then 1. Let _fSecondsDigits_ be the substring of CodePointsToString(_fSeconds_) from 1. 1. Let _fSecondsScale_ be the length of _fSecondsDigits_. - 1. Let _millisecondsMV_ be ? ToIntegerWithTruncation(_fSecondsDigits_) / 10_fSecondsScale_ × 1000. + 1. Let _millisecondsMV_ be ? ToIntegerWithTruncation(_fSecondsDigits_) / 10_fSecondsScale_ × 1000. 1. Else, - 1. Let _millisecondsMV_ be remainder(_secondsMV_, 1) × 1000. - 1. Let _microsecondsMV_ be remainder(_millisecondsMV_, 1) × 1000. - 1. Let _nanosecondsMV_ be remainder(_microsecondsMV_, 1) × 1000. + 1. Let _millisecondsMV_ be remainder(_secondsMV_, 1) × 1000. + 1. Let _microsecondsMV_ be remainder(_millisecondsMV_, 1) × 1000. + 1. Let _nanosecondsMV_ be remainder(_microsecondsMV_, 1) × 1000. 1. If _sign_ contains the code point U+002D (HYPHEN-MINUS), then 1. Let _factor_ be -1. 1. Else, 1. Let _factor_ be 1. - 1. Set _yearsMV_ to _yearsMV_ × _factor_. - 1. Set _monthsMV_ to _monthsMV_ × _factor_. - 1. Set _weeksMV_ to _weeksMV_ × _factor_. - 1. Set _daysMV_ to _daysMV_ × _factor_. - 1. Set _hoursMV_ to _hoursMV_ × _factor_. - 1. Set _minutesMV_ to floor(_minutesMV_) × _factor_. - 1. Set _secondsMV_ to floor(_secondsMV_) × _factor_. - 1. Set _millisecondsMV_ to floor(_millisecondsMV_) × _factor_. - 1. Set _microsecondsMV_ to floor(_microsecondsMV_) × _factor_. - 1. Set _nanosecondsMV_ to floor(_nanosecondsMV_) × _factor_. + 1. Set _yearsMV_ to _yearsMV_ × _factor_. + 1. Set _monthsMV_ to _monthsMV_ × _factor_. + 1. Set _weeksMV_ to _weeksMV_ × _factor_. + 1. Set _daysMV_ to _daysMV_ × _factor_. + 1. Set _hoursMV_ to _hoursMV_ × _factor_. + 1. Set _minutesMV_ to floor(_minutesMV_) × _factor_. + 1. Set _secondsMV_ to floor(_secondsMV_) × _factor_. + 1. Set _millisecondsMV_ to floor(_millisecondsMV_) × _factor_. + 1. Set _microsecondsMV_ to floor(_microsecondsMV_) × _factor_. + 1. Set _nanosecondsMV_ to floor(_nanosecondsMV_) × _factor_. 1. If IsValidDuration(_yearsMV_, _monthsMV_, _weeksMV_, _daysMV_, _hoursMV_, _minutesMV_, _secondsMV_, _millisecondsMV_, _microsecondsMV_, _nanosecondsMV_) is *false*, throw a *RangeError* exception. 1. Return CreateDurationRecord(_yearsMV_, _monthsMV_, _weeksMV_, _daysMV_, _hoursMV_, _minutesMV_, _secondsMV_, _millisecondsMV_, _microsecondsMV_, _nanosecondsMV_). @@ -2050,7 +2050,7 @@

1. Let _integer_ be ? ToIntegerWithTruncation(_argument_). - 1. If _integer_ ≤ 0, throw a *RangeError* exception. + 1. If _integer_ ≤ 0, throw a *RangeError* exception. 1. Return _integer_. @@ -2067,7 +2067,7 @@

1. Let _number_ be ? ToNumber(_argument_). - 1. If _number_ is *NaN*, *+∞*𝔽 or *-∞*𝔽, throw a *RangeError* exception. + 1. If _number_ is *NaN*, *+∞*𝔽 or *-∞*𝔽, throw a *RangeError* exception. 1. Return truncate(ℝ(_number_)). diff --git a/spec/duration.html b/spec/duration.html index 5ad67f114a..7da02ffc98 100644 --- a/spec/duration.html +++ b/spec/duration.html @@ -101,9 +101,9 @@

Temporal.Duration.compare ( _one_, _two_ [ , _options_ ] )

1. Let _plainRelativeTo_ be _relativeToRecord_.[[PlainRelativeTo]]. 1. Let _timeZoneRec_ be _relativeToRecord_.[[TimeZoneRec]]. 1. Let _calendarUnitsPresent_ be *false*. - 1. If _one_.[[Years]] ≠ 0, or _two_.[[Years]] ≠ 0, or _one_.[[Months]] ≠ 0, or _two_.[[Months]] ≠ 0, or _one_.[[Weeks]] ≠ 0, or _two_.[[Weeks]] ≠ 0, set _calendarUnitsPresent_ to *true*. + 1. If _one_.[[Years]] ≠ 0, or _two_.[[Years]] ≠ 0, or _one_.[[Months]] ≠ 0, or _two_.[[Months]] ≠ 0, or _one_.[[Weeks]] ≠ 0, or _two_.[[Weeks]] ≠ 0, set _calendarUnitsPresent_ to *true*. 1. Let _calendarRec_ be ? CreateCalendarMethodsRecordFromRelativeTo(_plainRelativeTo_, _zonedRelativeTo_, « ~date-add~ »). - 1. If _zonedRelativeTo_ is not *undefined*, and either _calendarUnitsPresent_ is *true*, or _one_.[[Days]] ≠ 0, or _two_.[[Days]] ≠ 0, then + 1. If _zonedRelativeTo_ is not *undefined*, and either _calendarUnitsPresent_ is *true*, or _one_.[[Days]] ≠ 0, or _two_.[[Days]] ≠ 0, then 1. Let _instant_ be ! CreateTemporalInstant(_zonedRelativeTo_.[[Nanoseconds]]). 1. Let _precalculatedPlainDateTime_ be ? GetPlainDateTimeFor(_timeZoneRec_, _instant_, _calendarRec_.[[Receiver]]). 1. Let _norm1_ be NormalizeTimeDuration(_one_.[[Hours]], _one_.[[Minutes]], _one_.[[Seconds]], _one_.[[Milliseconds]], _one_.[[Microseconds]], _one_.[[Nanoseconds]]). @@ -452,15 +452,15 @@

Temporal.Duration.prototype.round ( _roundTo_ )

1. Let _maximum_ be MaximumTemporalDurationRoundingIncrement(_smallestUnit_). 1. If _maximum_ is not *undefined*, perform ? ValidateTemporalRoundingIncrement(_roundingIncrement_, _maximum_, *false*). 1. Let _hoursToDaysConversionMayOccur_ be *false*. - 1. If _duration_.[[Days]] ≠ 0 and _zonedRelativeTo_ is not *undefined*, set _hoursToDaysConversionMayOccur_ to *true*. - 1. Else if abs(_duration_.[[Hours]]) ≥ 24, set _hoursToDaysConversionMayOccur_ to *true*. + 1. If _duration_.[[Days]] ≠ 0 and _zonedRelativeTo_ is not *undefined*, set _hoursToDaysConversionMayOccur_ to *true*. + 1. Else if abs(_duration_.[[Hours]]) ≥ 24, set _hoursToDaysConversionMayOccur_ to *true*. 1. If _smallestUnit_ is *"nanosecond"* and _roundingIncrement_ = 1, let _roundingGranularityIsNoop_ be *true*; else let _roundingGranularityIsNoop_ be *false*. 1. If _duration_.[[Years]] = 0 and _duration_.[[Months]] = 0 and _duration_.[[Weeks]] = 0, let _calendarUnitsPresent_ be *false*; else let _calendarUnitsPresent_ be *true*. 1. If _roundingGranularityIsNoop_ is *true*, and _largestUnit_ is _existingLargestUnit_, and _calendarUnitsPresent_ is *false*, and _hoursToDaysConversionMayOccur_ is *false*, and abs(_duration_.[[Minutes]]) < 60, and abs(_duration_.[[Seconds]]) < 60, and abs(_duration_.[[Milliseconds]]) < 1000, and abs(_duration_.[[Microseconds]]) < 1000, and abs(_duration_.[[Nanoseconds]]) < 1000, then 1. NOTE: The above conditions mean that the operation will have no effect: the smallest unit and rounding increment will leave the total duration unchanged, and it can be determined without calling a calendar or time zone method that no balancing will take place. 1. Return ! CreateTemporalDuration(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). 1. Let _precalculatedPlainDateTime_ be *undefined*. - 1. If IsCalendarUnit(_largestUnit_) is *true*, or _largestUnit_ is *"day"*, or _calendarUnitsPresent_ is *true*, or _duration_.[[Days]] ≠ 0, let _plainDateTimeOrRelativeToWillBeUsed_ be *true*; else let _plainDateTimeOrRelativeToWillBeUsed_ be *false*. + 1. If IsCalendarUnit(_largestUnit_) is *true*, or _largestUnit_ is *"day"*, or _calendarUnitsPresent_ is *true*, or _duration_.[[Days]] ≠ 0, let _plainDateTimeOrRelativeToWillBeUsed_ be *true*; else let _plainDateTimeOrRelativeToWillBeUsed_ be *false*. 1. If _zonedRelativeTo_ is not *undefined* and _plainDateTimeOrRelativeToWillBeUsed_ is *true*, then 1. NOTE: The above conditions mean that the corresponding `Temporal.PlainDateTime` or `Temporal.PlainDate` for _zonedRelativeTo_ will be used in one of the operations below. 1. Let _instant_ be ! CreateTemporalInstant(_zonedRelativeTo_.[[Nanoseconds]]). @@ -514,7 +514,7 @@

Temporal.Duration.prototype.total ( _totalOf_ )

1. Let _timeZoneRec_ be _relativeToRecord_.[[TimeZoneRec]]. 1. Let _unit_ be ? GetTemporalUnitValuedOption(_totalOf_, *"unit"*, ~datetime~, ~required~). 1. Let _precalculatedPlainDateTime_ be *undefined*. - 1. If IsCalendarUnit(_unit_) is *true*, or _unit_ is *"day"*, or _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, or _duration_.[[Days]] ≠ 0, let _plainDateTimeOrRelativeToWillBeUsed_ be *true*; else let _plainDateTimeOrRelativeToWillBeUsed_ be *false*. + 1. If IsCalendarUnit(_unit_) is *true*, or _unit_ is *"day"*, or _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, or _duration_.[[Days]] ≠ 0, let _plainDateTimeOrRelativeToWillBeUsed_ be *true*; else let _plainDateTimeOrRelativeToWillBeUsed_ be *false*. 1. If _zonedRelativeTo_ is not *undefined* and _plainDateTimeOrRelativeToWillBeUsed_ is *true*, then 1. NOTE: The above conditions mean that the corresponding `Temporal.PlainDateTime` or `Temporal.PlainDate` for _zonedRelativeTo_ will be used in one of the operations below. 1. Let _instant_ be ! CreateTemporalInstant(_zonedRelativeTo_.[[Nanoseconds]]). @@ -534,7 +534,7 @@

Temporal.Duration.prototype.total ( _totalOf_ )

1. Let _targetDate_ be ? AddDate(_calendarRec_, _plainRelativeTo_, _dateDuration_). 1. Let _roundRecord_ be ? DifferencePlainDateTimeWithRounding(_plainRelativeTo_.[[ISOYear]], _plainRelativeTo_.[[ISOMonth]], _plainRelativeTo_.[[ISODay]], 0, 0, 0, 0, 0, 0, _targetDate_.[[ISOYear]], _targetDate_.[[ISOMonth]], _targetDate_.[[ISODay]], _targetTime_.[[Hours]], _targetTime_.[[Minutes]], _targetTime_.[[Seconds]], _targetTime_.[[Milliseconds]], _targetTime_.[[Microseconds]], _targetTime_.[[Nanoseconds]], _calendarRec_, _unit_, 1, _unit_, *"trunc"*, _emptyOptions_). 1. Else, - 1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, or IsCalendarUnit(_unit_) is *true*, throw a *RangeError* exception. + 1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, or IsCalendarUnit(_unit_) is *true*, throw a *RangeError* exception. 1. Let _normWithDays_ be ? Add24HourDaysToNormalizedTimeDuration(_norm_, _duration_.[[Days]]). 1. Let _roundRecord_ be ? RoundTimeDuration(0, _normWithDays_, 1, _unit_, *"trunc"*). 1. Assert: _roundRecord_.[[Total]] is not ~unset~. @@ -557,7 +557,7 @@

Temporal.Duration.prototype.toString ( [ _options_ ] )

1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_options_, *"smallestUnit"*, ~time~, *undefined*). 1. If _smallestUnit_ is *"hour"* or *"minute"*, throw a *RangeError* exception. 1. Let _precision_ be ToSecondsStringPrecisionRecord(_smallestUnit_, _digits_). - 1. If _precision_.[[Unit]] is not *"nanosecond"* or _precision_.[[Increment]] ≠ 1, then + 1. If _precision_.[[Unit]] is not *"nanosecond"* or _precision_.[[Increment]] ≠ 1, then 1. Let _norm_ be NormalizeTimeDuration(_duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). 1. Let _largestUnit_ be DefaultTemporalLargestUnit(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]]). 1. Let _roundRecord_ be ? RoundTimeDuration(0, _norm_, _precision_.[[Increment]], _precision_.[[Unit]], _roundingMode_). @@ -894,7 +894,7 @@

Normalized Time Duration Records

an integer in the inclusive interval from -maxTimeDuration to maxTimeDuration, where - maxTimeDuration = 253 × 109 - 1 = 9,007,199,254,740,991,999,999,999 + maxTimeDuration = 253 × 109 - 1 = 9,007,199,254,740,991,999,999,999 @@ -1084,7 +1084,7 @@

1. Let _dateSign_ be DurationSign(_dateDurationRecord_.[[Years]], _dateDurationRecord_.[[Months]], _dateDurationRecord_.[[Weeks]], _dateDurationRecord_.[[Days]], 0, 0, 0, 0, 0, 0). 1. Let _timeSign_ be NormalizedTimeDurationSign(_norm_). - 1. If _dateSign_ ≠ 0 and _timeSign_ ≠ 0 and _dateSign_ ≠ _timeSign_, throw a *RangeError* exception. + 1. If _dateSign_ ≠ 0 and _timeSign_ ≠ 0 and _dateSign_ ≠ _timeSign_, throw a *RangeError* exception. 1. Return Normalized Duration Record { [[Years]]: _dateDurationRecord_.[[Years]], [[Months]]: _dateDurationRecord_.[[Months]], @@ -1199,12 +1199,12 @@

1. If 𝔽(_v_) is not finite, return *false*. 1. If _v_ < 0 and _sign_ > 0, return *false*. 1. If _v_ > 0 and _sign_ < 0, return *false*. - 1. If abs(_years_) ≥ 232, return *false*. - 1. If abs(_months_) ≥ 232, return *false*. - 1. If abs(_weeks_) ≥ 232, return *false*. - 1. Let _normalizedSeconds_ be _days_ × 86,400 + _hours_ × 3600 + _minutes_ × 60 + _seconds_ + ℝ(𝔽(_milliseconds_)) × 10-3 + ℝ(𝔽(_microseconds_)) × 10-6 + ℝ(𝔽(_nanoseconds_)) × 10-9. + 1. If abs(_years_) ≥ 232, return *false*. + 1. If abs(_months_) ≥ 232, return *false*. + 1. If abs(_weeks_) ≥ 232, return *false*. + 1. Let _normalizedSeconds_ be _days_ × 86,400 + _hours_ × 3600 + _minutes_ × 60 + _seconds_ + ℝ(𝔽(_milliseconds_)) × 10-3 + ℝ(𝔽(_microseconds_)) × 10-6 + ℝ(𝔽(_nanoseconds_)) × 10-9. 1. NOTE: The above step cannot be implemented directly using floating-point arithmetic. Multiplying by 10-3, 10-6, and 10-9 respectively may be imprecise when _milliseconds_, _microseconds_, or _nanoseconds_ is an unsafe integer. This multiplication can be implemented in C++ with an implementation of `std::remquo()` with sufficient bits in the quotient. String manipulation will also give an exact result, since the multiplication is by a power of 10. - 1. If abs(_normalizedSeconds_) ≥ 253, return *false*. + 1. If abs(_normalizedSeconds_) ≥ 253, return *false*. 1. Return *true*. @@ -1228,15 +1228,15 @@

It implements the logic used in the `Temporal.Duration.prototype.round()` method and elsewhere, where the `largestUnit` option, if not given explicitly, is set to the largest non-zero unit in the input Temporal.Duration.
- 1. If _years_ ≠ 0, return *"year"*. - 1. If _months_ ≠ 0, return *"month"*. - 1. If _weeks_ ≠ 0, return *"week"*. - 1. If _days_ ≠ 0, return *"day"*. - 1. If _hours_ ≠ 0, return *"hour"*. - 1. If _minutes_ ≠ 0, return *"minute"*. - 1. If _seconds_ ≠ 0, return *"second"*. - 1. If _milliseconds_ ≠ 0, return *"millisecond"*. - 1. If _microseconds_ ≠ 0, return *"microsecond"*. + 1. If _years_ ≠ 0, return *"year"*. + 1. If _months_ ≠ 0, return *"month"*. + 1. If _weeks_ ≠ 0, return *"week"*. + 1. If _days_ ≠ 0, return *"day"*. + 1. If _hours_ ≠ 0, return *"hour"*. + 1. If _minutes_ ≠ 0, return *"minute"*. + 1. If _seconds_ ≠ 0, return *"second"*. + 1. If _milliseconds_ ≠ 0, return *"millisecond"*. + 1. If _microseconds_ ≠ 0, return *"microsecond"*. 1. Return *"nanosecond"*. @@ -1350,16 +1350,16 @@

From the given units, it computes a normalized time duration consisting of whole seconds, and subseconds expressed in nanoseconds. The normalized time duration can be stored losslessly in two 64-bit floating point numbers. - Alternatively, _normalizedSeconds_ × 109 + _subseconds_ can be stored as a 96-bit integer. + Alternatively, _normalizedSeconds_ × 109 + _subseconds_ can be stored as a 96-bit integer.
- 1. Set _minutes_ to _minutes_ + _hours_ × 60. - 1. Set _seconds_ to _seconds_ + _minutes_ × 60. - 1. Set _milliseconds_ to _milliseconds_ + _seconds_ × 1000. - 1. Set _microseconds_ to _microseconds_ + _milliseconds_ × 1000. - 1. Set _nanoseconds_ to _nanoseconds_ + _microseconds_ × 1000. - 1. Assert: abs(_nanoseconds_) ≤ maxTimeDuration. + 1. Set _minutes_ to _minutes_ + _hours_ × 60. + 1. Set _seconds_ to _seconds_ + _minutes_ × 60. + 1. Set _milliseconds_ to _milliseconds_ + _seconds_ × 1000. + 1. Set _microseconds_ to _microseconds_ + _milliseconds_ × 1000. + 1. Set _nanoseconds_ to _nanoseconds_ + _microseconds_ × 1000. + 1. Assert: abs(_nanoseconds_) ≤ maxTimeDuration. 1. Return Normalized Time Duration Record { [[TotalNanoseconds]]: _nanoseconds_ }. @@ -1412,7 +1412,7 @@

- 1. Let _result_ be _d_.[[TotalNanoseconds]] + _days_ × nsPerDay. + 1. Let _result_ be _d_.[[TotalNanoseconds]] + _days_ × nsPerDay. 1. If abs(_result_) > maxTimeDuration, throw a *RangeError* exception. 1. Return Normalized Time Duration Record { [[TotalNanoseconds]]: _result_ }. @@ -1467,7 +1467,7 @@

It divides the total number of nanoseconds in the normalized time duration _d_ by _divisor_.
- 1. Assert: _divisor_ ≠ 0. + 1. Assert: _divisor_ ≠ 0. 1. NOTE: The following step cannot be implemented directly using floating-point arithmetic when 𝔽(_d_.[[TotalNanoseconds]]) is not a safe integer. The division can be implemented in C++ with the `__float128` type if the compiler supports it, or with software emulation such as in the SoftFP library. 1. Return _d_.[[TotalNanoseconds]] / _divisor_. @@ -1486,7 +1486,7 @@

1. Let _result_ be ℝ(_one_) - ℝ(_two_). - 1. Assert: abs(_result_) ≤ maxTimeDuration. + 1. Assert: abs(_result_) ≤ maxTimeDuration. 1. Return Normalized Time Duration Record { [[TotalNanoseconds]]: _result_ }. @@ -1549,7 +1549,7 @@

description
-
It returns 0 if the duration is zero, or ±1 depending on the sign of the duration.
+
It returns 0 if the duration is zero, or ±1 depending on the sign of the duration.
1. If _d_.[[TotalNanoseconds]] < 0, return -1. @@ -1677,7 +1677,7 @@

1. Assert: _largestUnit_ is *"nanosecond"*. 1. NOTE: When _largestUnit_ is *"millisecond"*, *"microsecond"*, or *"nanosecond"*, _milliseconds_, _microseconds_, or _nanoseconds_ may be an unsafe integer. In this case, care must be taken when implementing the calculation using floating point arithmetic. It can be implemented in C++ using `std::fma()`. String manipulation will also give an exact result, since the multiplication is by a power of 10. 1. If IsValidDuration(0, 0, 0, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_) is *false*, throw a *RangeError* exception. - 1. Return CreateTimeDurationRecord(_days_ × _sign_, _hours_ × _sign_, _minutes_ × _sign_, _seconds_ × _sign_, _milliseconds_ × _sign_, _microseconds_ × _sign_, _nanoseconds_ × _sign_). + 1. Return CreateTimeDurationRecord(_days_ × _sign_, _hours_ × _sign_, _minutes_ × _sign_, _seconds_ × _sign_, _milliseconds_ × _sign_, _microseconds_ × _sign_, _nanoseconds_ × _sign_). @@ -1753,7 +1753,7 @@

1. Assert: The value in the "Category" column of the row of whose "Singular" column contains _unit_, is ~time~. 1. Let _divisor_ be the value in the "Length in Nanoseconds" column of the row of whose "Singular" column contains _unit_. 1. Let _total_ be DivideNormalizedTimeDuration(_norm_, _divisor_). - 1. Set _norm_ to ? RoundNormalizedTimeDurationToIncrement(_norm_, _divisor_ × _increment_, _roundingMode_). + 1. Set _norm_ to ? RoundNormalizedTimeDurationToIncrement(_norm_, _divisor_ × _increment_, _roundingMode_). 1. Return the Record { [[NormalizedDuration]]: ? CreateNormalizedDurationRecord(0, 0, 0, _days_, _norm_), [[Total]]: _total_ @@ -1832,13 +1832,13 @@

1. If _unit_ is *"year"*, then 1. Let _years_ be RoundNumberToIncrement(_duration_.[[Years]], _increment_, *"trunc"*). 1. Let _r1_ be _years_. - 1. Let _r2_ be _years_ + _increment_ × _sign_. + 1. Let _r2_ be _years_ + _increment_ × _sign_. 1. Let _startDuration_ be ? CreateDateDurationRecord(_r1_, 0, 0, 0). 1. Let _endDuration_ be ? CreateDateDurationRecord(_r2_, 0, 0, 0). 1. Else if _unit_ is *"month"*, then 1. Let _months_ be RoundNumberToIncrement(_duration_.[[Months]], _increment_, *"trunc"*). 1. Let _r1_ be _months_. - 1. Let _r2_ be _months_ + _increment_ × _sign_. + 1. Let _r2_ be _months_ + _increment_ × _sign_. 1. Let _startDuration_ be ? CreateDateDurationRecord(_duration_.[[Years]], _r1_, 0, 0). 1. Let _endDuration_ be ? CreateDateDurationRecord(_duration_.[[Years]], _r2_, 0, 0). 1. Else if _unit_ is *"week"*, then @@ -1851,18 +1851,18 @@

1. Let _untilResult_ be ? DifferenceDate(_calendarRec_, _weeksStart_, _weeksEnd_, _untilOptions_). 1. Let _weeks_ be RoundNumberToIncrement(_duration_.[[Weeks]] + _untilResult_.[[Weeks]], _increment_, *"trunc"*). 1. Let _r1_ be _weeks_. - 1. Let _r2_ be _weeks_ + _increment_ × _sign_. + 1. Let _r2_ be _weeks_ + _increment_ × _sign_. 1. Let _startDuration_ be ? CreateDateDurationRecord(_duration_.[[Years]], _duration_.[[Months]], _r1_, 0). 1. Let _endDuration_ be ? CreateDateDurationRecord(_duration_.[[Years]], _duration_.[[Months]], _r2_, 0). 1. Else, 1. Assert: _unit_ is *"day"*. 1. Let _days_ be RoundNumberToIncrement(_duration_.[[Days]], _increment_, *"trunc"*). 1. Let _r1_ be _days_. - 1. Let _r2_ be _days_ + _increment_ × _sign_. + 1. Let _r2_ be _days_ + _increment_ × _sign_. 1. Let _startDuration_ be ? CreateDateDurationRecord(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _r1_). 1. Let _endDuration_ be ? CreateDateDurationRecord(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _r2_). - 1. Assert: If _sign_ is 1, _r1_ ≥ 0 and _r1_ < _r2_. - 1. Assert: If _sign_ is -1, _r1_ ≤ 0 and _r1_ > _r2_. + 1. Assert: If _sign_ is 1, _r1_ ≥ 0 and _r1_ < _r2_. + 1. Assert: If _sign_ is -1, _r1_ ≤ 0 and _r1_ > _r2_. 1. Let _startDate_ be ! CreateTemporalDate(_dateTime_.[[Year]], _dateTime_.[[Month]], _dateTime_.[[Day]], _calendarRec_.[[Receiver]]). 1. Let _start_ be ? AddDate(_calendarRec_, _startDate_, ! CreateTemporalDuration(_startDuration_.[[Years]], _startDuration_.[[Months]], _startDuration_.[[Weeks]], _startDuration_.[[Days]], 0, 0, 0, 0, 0, 0)). 1. Let _endDate_ be ! CreateTemporalDate(_dateTime_.[[Year]], _dateTime_.[[Month]], _dateTime_.[[Day]], _calendarRec_.[[Receiver]]). @@ -1878,19 +1878,19 @@

1. Let _endInstant_ be ? GetInstantFor(_timeZoneRec_, _endDateTime_, *"compatible"*). 1. Let _endEpochNs_ be _endInstant_.[[Nanoseconds]]. 1. If _sign_ is 1, then - 1. If _startEpochNs_ > _destEpochNs_ or _destEpochNs_ ≥ _endEpochNs_, throw a *RangeError* exception. - 1. Assert: _startEpochNs_ ≤ _destEpochNs_ < _endEpochNs_. + 1. If _startEpochNs_ > _destEpochNs_ or _destEpochNs_ ≥ _endEpochNs_, throw a *RangeError* exception. + 1. Assert: _startEpochNs_ ≤ _destEpochNs_ < _endEpochNs_. 1. Else, - 1. If _endEpochNs_ ≥ _destEpochNs_ or _destEpochNs_ > _startEpochNs_, throw a *RangeError* exception. - 1. Assert: _endEpochNs_ < _destEpochNs_ ≤ _startEpochNs_. - 1. Assert: _startEpochNs_ ≠ _endEpochNs_. + 1. If _endEpochNs_ ≥ _destEpochNs_ or _destEpochNs_ > _startEpochNs_, throw a *RangeError* exception. + 1. Assert: _endEpochNs_ < _destEpochNs_ ≤ _startEpochNs_. + 1. Assert: _startEpochNs_ ≠ _endEpochNs_. 1. Let _progress_ be (_destEpochNs_ - _startEpochNs_) / (_endEpochNs_ - _startEpochNs_). - 1. Let _total_ be _r1_ + _progress_ × _increment_ × _sign_. + 1. Let _total_ be _r1_ + _progress_ × _increment_ × _sign_. 1. NOTE: The above two steps cannot be implemented directly using floating-point arithmetic. This division can be implemented as if constructing Normalized Time Duration Records for the denominator and numerator of _total_ and performing one division operation with a floating-point result. - 1. Assert: 0 ≤ _progress_ < 1. + 1. Assert: 0 ≤ _progress_ < 1. 1. If _sign_ < 0, let _isNegative_ be ~negative~; else let _isNegative_ be ~positive~. 1. Let _unsignedRoundingMode_ be GetUnsignedRoundingMode(_roundingMode_, _isNegative_). - 1. Assert: abs(_r1_) ≤ abs(_total_) < abs(_r2_). + 1. Assert: abs(_r1_) ≤ abs(_total_) < abs(_r2_). 1. Let _roundedUnit_ be ApplyUnsignedRoundingMode(abs(_total_), abs(_r1_), abs(_r2_), _unsignedRoundingMode_). 1. If _roundedUnit_ is abs(_r2_), then 1. Let _didExpandCalendarUnit_ be *true*. @@ -1942,12 +1942,12 @@

1. Let _daySpan_ be NormalizedTimeDurationFromEpochNanosecondsDifference(_endEpochNs_, _startEpochNs_). 1. Assert: NormalizedTimeDurationSign(_daySpan_) = _sign_. 1. Let _unitLength_ be the value in the "Length in Nanoseconds" column of the row of whose "Singular" column contains _unit_. - 1. Let _roundedNorm_ be ? RoundNormalizedTimeDurationToIncrement(_duration_.[[NormalizedTime]], _increment_ × _unitLength_, _roundingMode_). + 1. Let _roundedNorm_ be ? RoundNormalizedTimeDurationToIncrement(_duration_.[[NormalizedTime]], _increment_ × _unitLength_, _roundingMode_). 1. Let _beyondDaySpan_ be ? SubtractNormalizedTimeDuration(_roundedNorm_, _daySpan_). - 1. If NormalizedTimeDurationSign(_beyondDaySpan_) ≠ -_sign_, then + 1. If NormalizedTimeDurationSign(_beyondDaySpan_) ≠ -_sign_, then 1. Let _didRoundBeyondDay_ be *true*. 1. Let _dayDelta_ be _sign_. - 1. Set _roundedNorm_ to ? RoundNormalizedTimeDurationToIncrement(_beyondDaySpan_, _increment_ × _unitLength_, _roundingMode_). + 1. Set _roundedNorm_ to ? RoundNormalizedTimeDurationToIncrement(_beyondDaySpan_, _increment_ × _unitLength_, _roundingMode_). 1. Let _nudgedEpochNs_ be AddNormalizedTimeDurationToEpochNanoseconds(_roundedNorm_, _endEpochNs_). 1. Else, 1. Let _didRoundBeyondDay_ be *false*. @@ -1980,7 +1980,7 @@

1. Let _norm_ be ! Add24HourDaysToNormalizedTimeDuration(_duration_.[[NormalizedTime]], _duration_.[[Days]]). 1. Let _unitLength_ be the value in the "Length in Nanoseconds" column of the row of whose "Singular" column contains _smallestUnit_. 1. Let _total_ be DivideNormalizedTimeDuration(_norm_, _unitLength_). - 1. Let _roundedNorm_ be ? RoundNormalizedTimeDurationToIncrement(_norm_, _unitLength_ × _increment_, _roundingMode_). + 1. Let _roundedNorm_ be ? RoundNormalizedTimeDurationToIncrement(_norm_, _unitLength_ × _increment_, _roundingMode_). 1. Let _diffNorm_ be ! SubtractNormalizedTimeDuration(_roundedNorm_, _norm_). 1. Let _wholeDays_ be truncate(DivideNormalizedTimeDuration(_norm_, nsPerDay)). 1. Let _roundedFractionalDays_ be DivideNormalizedTimeDuration(_roundedNorm_, nsPerDay). @@ -1993,7 +1993,7 @@

1. Let _remainder_ be _roundedNorm_. 1. If LargerOfTwoTemporalUnits(_largestUnit_, *"day"*) is _largestUnit_, then 1. Set _days_ to _roundedWholeDays_. - 1. Set _remainder_ to remainder(_roundedFractionalDays_, 1) × nsPerDay. + 1. Set _remainder_ to remainder(_roundedFractionalDays_, 1) × nsPerDay. 1. Let _resultDuration_ be ? CreateNormalizedDurationRecord(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _days_, _remainder_). 1. Return Duration Nudge Result Record { [[Duration]]: _resultDuration_, [[Total]]: _total_, [[NudgedEpochNs]]: _nudgedEpochNs_, [[DidExpandCalendarUnit]]: _didExpandDays_ }. @@ -2026,7 +2026,7 @@

1. Let _smallestUnitIndex_ be the ordinal index of the row of whose "Singular" column contains _smallestUnit_. 1. Let _unitIndex_ be _smallestUnitIndex_ - 1. 1. Let _done_ be *false*. - 1. Repeat, while _unitIndex_ ≤ _largestUnitIndex_ and _done_ is *false*, + 1. Repeat, while _unitIndex_ ≤ _largestUnitIndex_ and _done_ is *false*, 1. Let _unit_ be the value in the "Singular" column of in the row whose ordinal index is _unitIndex_. 1. If _unit_ is not *"week"*, or _largestUnit_ is *"week"*, then 1. If _unit_ is *"year"*, then @@ -2052,7 +2052,7 @@

1. Let _endEpochNs_ be _endInstant_.[[Nanoseconds]]. 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. - 1. If _beyondEndSign_ ≠ -_sign_, then + 1. If _beyondEndSign_ ≠ -_sign_, then 1. Set _duration_ to ! CombineDateAndNormalizedTimeDuration(_endDuration_, ZeroTimeDuration()). 1. Else, 1. Set _done_ to *true*. @@ -2182,16 +2182,16 @@

1. Let _ms1_ be _duration_.[[Milliseconds]]. 1. Let _mus1_ be _duration_.[[Microseconds]]. 1. Let _ns1_ be _duration_.[[Nanoseconds]]. - 1. Let _y2_ be _sign_ × _other_.[[Years]]. - 1. Let _mon2_ be _sign_ × _other_.[[Months]]. - 1. Let _w2_ be _sign_ × _other_.[[Weeks]]. - 1. Let _d2_ be _sign_ × _other_.[[Days]]. - 1. Let _h2_ be _sign_ × _other_.[[Hours]]. - 1. Let _min2_ be _sign_ × _other_.[[Minutes]]. - 1. Let _s2_ be _sign_ × _other_.[[Seconds]]. - 1. Let _ms2_ be _sign_ × _other_.[[Milliseconds]]. - 1. Let _mus2_ be _sign_ × _other_.[[Microseconds]]. - 1. Let _ns2_ be _sign_ × _other_.[[Nanoseconds]]. + 1. Let _y2_ be _sign_ × _other_.[[Years]]. + 1. Let _mon2_ be _sign_ × _other_.[[Months]]. + 1. Let _w2_ be _sign_ × _other_.[[Weeks]]. + 1. Let _d2_ be _sign_ × _other_.[[Days]]. + 1. Let _h2_ be _sign_ × _other_.[[Hours]]. + 1. Let _min2_ be _sign_ × _other_.[[Minutes]]. + 1. Let _s2_ be _sign_ × _other_.[[Seconds]]. + 1. Let _ms2_ be _sign_ × _other_.[[Milliseconds]]. + 1. Let _mus2_ be _sign_ × _other_.[[Microseconds]]. + 1. Let _ns2_ be _sign_ × _other_.[[Nanoseconds]]. 1. Let _largestUnit1_ be DefaultTemporalLargestUnit(_y1_, _mon1_, _w1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mus1_). 1. Let _largestUnit2_ be DefaultTemporalLargestUnit(_y2_, _mon2_, _w2_, _d2_, _h2_, _min2_, _s2_, _ms2_, _mus2_). 1. Let _largestUnit_ be LargerOfTwoTemporalUnits(_largestUnit1_, _largestUnit2_). diff --git a/spec/instant.html b/spec/instant.html index 04157b1a0c..3a84790dcf 100644 --- a/spec/instant.html +++ b/spec/instant.html @@ -69,7 +69,7 @@

Temporal.Instant.fromEpochMilliseconds ( _epochMilliseconds_ )

1. Set _epochMilliseconds_ to ? ToNumber(_epochMilliseconds_). 1. Set _epochMilliseconds_ to ? NumberToBigInt(_epochMilliseconds_). - 1. Let _epochNanoseconds_ be _epochMilliseconds_ × ℤ(106). + 1. Let _epochNanoseconds_ be _epochMilliseconds_ × ℤ(106). 1. If IsValidEpochNanoseconds(_epochNanoseconds_) is *false*, throw a *RangeError* exception. 1. Return ! CreateTemporalInstant(_epochNanoseconds_). @@ -225,13 +225,13 @@

Temporal.Instant.prototype.round ( _roundTo_ )

1. If _smallestUnit_ is *"hour"*, then 1. Let _maximum_ be HoursPerDay. 1. Else if _smallestUnit_ is *"minute"*, then - 1. Let _maximum_ be MinutesPerHour × HoursPerDay. + 1. Let _maximum_ be MinutesPerHour × HoursPerDay. 1. Else if _smallestUnit_ is *"second"*, then - 1. Let _maximum_ be SecondsPerMinute × MinutesPerHour × HoursPerDay. + 1. Let _maximum_ be SecondsPerMinute × MinutesPerHour × HoursPerDay. 1. Else if _smallestUnit_ is *"millisecond"*, then 1. Let _maximum_ be ℝ(msPerDay). 1. Else if _smallestUnit_ is *"microsecond"*, then - 1. Let _maximum_ be 103 × ℝ(msPerDay). + 1. Let _maximum_ be 103 × ℝ(msPerDay). 1. Else, 1. Assert: _smallestUnit_ is *"nanosecond"*. 1. Let _maximum_ be nsPerDay. @@ -250,7 +250,7 @@

Temporal.Instant.prototype.equals ( _other_ )

1. Let _instant_ be the *this* value. 1. Perform ? RequireInternalSlot(_instant_, [[InitializedTemporalInstant]]). 1. Set _other_ to ? ToTemporalInstant(_other_). - 1. If _instant_.[[Nanoseconds]] ≠ _other_.[[Nanoseconds]], return *false*. + 1. If _instant_.[[Nanoseconds]] ≠ _other_.[[Nanoseconds]], return *false*. 1. Return *true*.
@@ -390,12 +390,12 @@

Temporal.Instant range

The maximum value is ℤ(nsMaxInstant), where

- nsMaxInstant = 108 × nsPerDay = 8.64 × 1021 + nsMaxInstant = 108 × nsPerDay = 8.64 × 1021

where the number of nanoseconds per day is

- nsPerDay = 106 × ℝ(msPerDay) = 8.64 × 1013 + nsPerDay = 106 × ℝ(msPerDay) = 8.64 × 1013

The minimum value is ℤ(nsMinInstant), where

- nsMinInstant = -nsMaxInstant = -8.64 × 1021 + nsMinInstant = -nsMaxInstant = -8.64 × 1021 @@ -540,7 +540,7 @@

1. Assert: The value in the "Category" column of the row of whose "Singular" column contains _unit_, is ~time~. 1. Let _unitLength_ be the value in the "Length in Nanoseconds" column of the row of whose "Singular" column contains _unit_. - 1. Let _incrementNs_ be _increment_ × _unitLength_. + 1. Let _incrementNs_ be _increment_ × _unitLength_. 1. Return ℤ(RoundNumberToIncrementAsIfPositive(ℝ(_ns_), _incrementNs_, _roundingMode_)). @@ -589,11 +589,11 @@

1. If _operation_ is ~since~, let _sign_ be -1. Otherwise, let _sign_ be 1. 1. Set _other_ to ? ToTemporalInstant(_other_). 1. Let _resolvedOptions_ be ? SnapshotOwnProperties(? GetOptionsObject(_options_), *null*). - 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~time~, « », *"nanosecond"*, *"second"*). + 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~time~, « », *"nanosecond"*, *"second"*). 1. Let _diffRecord_ be DifferenceInstant(_instant_.[[Nanoseconds]], _other_.[[Nanoseconds]], _settings_.[[RoundingIncrement]], _settings_.[[SmallestUnit]], _settings_.[[RoundingMode]]). 1. Let _norm_ be _diffRecord_.[[NormalizedTimeDuration]]. 1. Let _result_ be ! BalanceTimeDuration(_norm_, _settings_.[[LargestUnit]]). - 1. Return ! CreateTemporalDuration(0, 0, 0, 0, _sign_ × _result_.[[Hours]], _sign_ × _result_.[[Minutes]], _sign_ × _result_.[[Seconds]], _sign_ × _result_.[[Milliseconds]], _sign_ × _result_.[[Microseconds]], _sign_ × _result_.[[Nanoseconds]]). + 1. Return ! CreateTemporalDuration(0, 0, 0, 0, _sign_ × _result_.[[Hours]], _sign_ × _result_.[[Minutes]], _sign_ × _result_.[[Seconds]], _sign_ × _result_.[[Milliseconds]], _sign_ × _result_.[[Microseconds]], _sign_ × _result_.[[Nanoseconds]]). @@ -616,7 +616,7 @@

1. If _duration_.[[Months]] is not 0, throw a *RangeError* exception. 1. If _duration_.[[Weeks]] is not 0, throw a *RangeError* exception. 1. If _duration_.[[Years]] is not 0, throw a *RangeError* exception. - 1. Let _norm_ be NormalizeTimeDuration(_sign_ × _duration_.[[Hours]], _sign_ × _duration_.[[Minutes]], _sign_ × _duration_.[[Seconds]], _sign_ × _duration_.[[Milliseconds]], _sign_ × _duration_.[[Microseconds]], _sign_ × _duration_.[[Nanoseconds]]). + 1. Let _norm_ be NormalizeTimeDuration(_sign_ × _duration_.[[Hours]], _sign_ × _duration_.[[Minutes]], _sign_ × _duration_.[[Seconds]], _sign_ × _duration_.[[Milliseconds]], _sign_ × _duration_.[[Microseconds]], _sign_ × _duration_.[[Nanoseconds]]). 1. Let _ns_ be ? AddInstant(_instant_.[[Nanoseconds]], _norm_). 1. Return ! CreateTemporalInstant(_ns_). diff --git a/spec/intl.html b/spec/intl.html index b3016ea69e..402e163bd4 100644 --- a/spec/intl.html +++ b/spec/intl.html @@ -631,11 +631,11 @@

- 1. Let _dateTimeFormat_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%Intl.DateTimeFormat.prototype%"*, « [[InitializedDateTimeFormat]], [[Locale]], [[Calendar]], [[NumberingSystem]], [[TimeZone]], [[HourCycle]], [[DateStyle]], [[TimeStyle]], [[DateTimeFormat]], [[TemporalPlainDateFormat]], [[TemporalPlainYearMonthFormat]], [[TemporalPlainMonthDayFormat]], [[TemporalPlainTimeFormat]], [[TemporalPlainDateTimeFormat]], [[TemporalInstantFormat]], [[BoundFormat]] »). + 1. Let _dateTimeFormat_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%Intl.DateTimeFormat.prototype%"*, « [[InitializedDateTimeFormat]], [[Locale]], [[Calendar]], [[NumberingSystem]], [[TimeZone]], [[HourCycle]], [[DateStyle]], [[TimeStyle]], [[DateTimeFormat]], [[TemporalPlainDateFormat]], [[TemporalPlainYearMonthFormat]], [[TemporalPlainMonthDayFormat]], [[TemporalPlainTimeFormat]], [[TemporalPlainDateTimeFormat]], [[TemporalInstantFormat]], [[BoundFormat]] »). 1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_). 1. Set _options_ to ? CoerceOptionsToObject(_options_). 1. Let _opt_ be a new Record. - 1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*). + 1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*). 1. Set _opt_.[[localeMatcher]] to _matcher_. 1. Let _calendar_ be ? GetOption(_options_, *"calendar"*, ~string~, ~empty~, *undefined*). 1. If _calendar_ is not *undefined*, then @@ -646,7 +646,7 @@

1. If _numberingSystem_ cannot be matched by the type Unicode locale nonterminal, throw a *RangeError* exception. 1. Set _opt_.[[nu]] to _numberingSystem_. 1. Let _hour12_ be ? GetOption(_options_, *"hour12"*, ~boolean~, ~empty~, *undefined*). - 1. Let _hourCycle_ be ? GetOption(_options_, *"hourCycle"*, ~string~, « *"h11"*, *"h12"*, *"h23"*, *"h24"* », *undefined*). + 1. Let _hourCycle_ be ? GetOption(_options_, *"hourCycle"*, ~string~, « *"h11"*, *"h12"*, *"h23"*, *"h24"* », *undefined*). 1. If _hour12_ is not *undefined*, then 1. Set _hourCycle_ to *null*. 1. Set _opt_.[[hc]] to _hourCycle_. @@ -704,10 +704,10 @@

1. Set _formatOptions_.[[<_prop_>]] to _value_. 1. If _value_ is not *undefined*, then 1. Set _hasExplicitFormatComponents_ to *true*. - 1. Let _formatMatcher_ be ? GetOption(_options_, *"formatMatcher"*, ~string~, « *"basic"*, *"best fit"* », *"best fit"*). - 1. Let _dateStyle_ be ? GetOption(_options_, *"dateStyle"*, ~string~, « *"full"*, *"long"*, *"medium"*, *"short"* », *undefined*). + 1. Let _formatMatcher_ be ? GetOption(_options_, *"formatMatcher"*, ~string~, « *"basic"*, *"best fit"* », *"best fit"*). + 1. Let _dateStyle_ be ? GetOption(_options_, *"dateStyle"*, ~string~, « *"full"*, *"long"*, *"medium"*, *"short"* », *undefined*). 1. Set _dateTimeFormat_.[[DateStyle]] to _dateStyle_. - 1. Let _timeStyle_ be ? GetOption(_options_, *"timeStyle"*, ~string~, « *"full"*, *"long"*, *"medium"*, *"short"* », *undefined*). + 1. Let _timeStyle_ be ? GetOption(_options_, *"timeStyle"*, ~string~, « *"full"*, *"long"*, *"medium"*, *"short"* », *undefined*). 1. Set _dateTimeFormat_.[[TimeStyle]] to _timeStyle_. 1. If _dateStyle_ is not *undefined* or _timeStyle_ is not *undefined*, then 1. If _hasExplicitFormatComponents_ is *true*, then @@ -735,18 +735,18 @@

1. Else, 1. Let _needDefaults_ be *true*. 1. If _required_ is ~date~ or ~any~, then - 1. For each property name _prop_ of « *"weekday"*, *"year"*, *"month"*, *"day"* », do + 1. For each property name _prop_ of « *"weekday"*, *"year"*, *"month"*, *"day"* », do 1. Let _value_ be _formatOptions_.[[<_prop_>]]. 1. If _value_ is not *undefined*, set _needDefaults_ to *false*. 1. If _required_ is ~time~ or ~any~, then - 1. For each property name _prop_ of « *"dayPeriod"*, *"hour"*, *"minute"*, *"second"*, *"fractionalSecondDigits"* », do + 1. For each property name _prop_ of « *"dayPeriod"*, *"hour"*, *"minute"*, *"second"*, *"fractionalSecondDigits"* », do 1. Let _value_ be _formatOptions_.[[<_prop_>]]. 1. If _value_ is not *undefined*, set _needDefaults_ to *false*. 1. If _needDefaults_ is *true* and _defaults_ is either ~date~ or ~all~, then - 1. For each property name _prop_ of « *"year"*, *"month"*, *"day"* », do + 1. For each property name _prop_ of « *"year"*, *"month"*, *"day"* », do 1. Set _formatOptions_.[[<_prop_>]] to *"numeric"*. 1. If _needDefaults_ is *true* and _defaults_ is either ~time~ or ~all~, then - 1. For each property name _prop_ of « *"hour"*, *"minute"*, *"second"* », do + 1. For each property name _prop_ of « *"hour"*, *"minute"*, *"second"* », do 1. Set _formatOptions_.[[<_prop_>]] to *"numeric"*. 1. Let _formats_ be _resolvedLocaleData_.[[formats]].[[<_resolvedCalendar_>]]. 1. If _formatMatcher_ is *"basic"*, then @@ -790,7 +790,7 @@

Internal slots

[[LocaleData]].[[<_locale_>]].[[nu]] must be a List that does not include the values *"native"*, *"traditio"*, or *"finance"*.
  • - [[LocaleData]].[[<_locale_>]].[[hc]] must be « *null*, *"h11"*, *"h12"*, *"h23"*, *"h24"* ». + [[LocaleData]].[[<_locale_>]].[[hc]] must be « *null*, *"h11"*, *"h12"*, *"h23"*, *"h24"* ».
  • [[LocaleData]].[[<_locale_>]].[[hourCycle]] must be one of the String values *"h11"*, *"h12"*, *"h23"*, or *"h24"*. @@ -845,27 +845,27 @@

    1. If _required_ is ~date~, then - 1. Let _requiredOptions_ be « *"weekday"*, *"year"*, *"month"*, *"day"* ». + 1. Let _requiredOptions_ be « *"weekday"*, *"year"*, *"month"*, *"day"* ». 1. Else if _required_ is ~time~, then - 1. Let _requiredOptions_ be « *"dayPeriod"*, *"hour"*, *"minute"*, *"second"*, *"fractionalSecondDigits"* ». + 1. Let _requiredOptions_ be « *"dayPeriod"*, *"hour"*, *"minute"*, *"second"*, *"fractionalSecondDigits"* ». 1. Else if _required_ is ~year-month~, then - 1. Let _requiredOptions_ be « *"year"*, *"month"* ». + 1. Let _requiredOptions_ be « *"year"*, *"month"* ». 1. Else if _required_ is ~month-day~, then - 1. Let _requiredOptions_ be « *"month"*, *"day"* ». + 1. Let _requiredOptions_ be « *"month"*, *"day"* ». 1. Else, 1. Assert: _required_ is ~any~. - 1. Let _requiredOptions_ be « *"weekday"*, *"year"*, *"month"*, *"day"*, *"dayPeriod"*, *"hour"*, *"minute"*, *"second"*, *"fractionalSecondDigits"* ». + 1. Let _requiredOptions_ be « *"weekday"*, *"year"*, *"month"*, *"day"*, *"dayPeriod"*, *"hour"*, *"minute"*, *"second"*, *"fractionalSecondDigits"* ». 1. If _defaults_ is ~date~, then - 1. Let _defaultOptions_ be « *"year"*, *"month"*, *"day"* ». + 1. Let _defaultOptions_ be « *"year"*, *"month"*, *"day"* ». 1. Else if _defaults_ is ~time~, then - 1. Let _defaultOptions_ be « *"hour"*, *"minute"*, *"second"* ». + 1. Let _defaultOptions_ be « *"hour"*, *"minute"*, *"second"* ». 1. Else if _defaults_ is ~year-month~, then - 1. Let _defaultOptions_ be « *"year"*, *"month"* ». + 1. Let _defaultOptions_ be « *"year"*, *"month"* ». 1. Else if _defaults_ is ~month-day~, then - 1. Let _defaultOptions_ be « *"month"*, *"day"* ». + 1. Let _defaultOptions_ be « *"month"*, *"day"* ». 1. Else, 1. Assert: _defaults_ is ~zoned-date-time~ or ~all~. - 1. Let _defaultOptions_ be « *"year"*, *"month"*, *"day"*, *"hour"*, *"minute"*, *"second"* ». + 1. Let _defaultOptions_ be « *"year"*, *"month"*, *"day"*, *"hour"*, *"minute"*, *"second"* ». 1. If _inherit_ is ~all~, then 1. Let _formatOptions_ be a copy of _options_. 1. Else, @@ -935,18 +935,18 @@

    1. Let _locale_ be _dateTimeFormat_.[[Locale]]. 1. Let _nfOptions_ be OrdinaryObjectCreate(*null*). 1. Perform ! CreateDataPropertyOrThrow(_nfOptions_, *"useGrouping"*, *false*). - 1. Let _nf_ be ! Construct(%Intl.NumberFormat%, « _locale_, _nfOptions_ »). + 1. Let _nf_ be ! Construct(%Intl.NumberFormat%, « _locale_, _nfOptions_ »). 1. Let _nf2Options_ be OrdinaryObjectCreate(*null*). 1. Perform ! CreateDataPropertyOrThrow(_nf2Options_, *"minimumIntegerDigits"*, *2*𝔽). 1. Perform ! CreateDataPropertyOrThrow(_nf2Options_, *"useGrouping"*, *false*). - 1. Let _nf2_ be ! Construct(%Intl.NumberFormat%, « _locale_, _nf2Options_ »). + 1. Let _nf2_ be ! Construct(%Intl.NumberFormat%, « _locale_, _nf2Options_ »). 1. If _format_ has a field [[fractionalSecondDigits]], then 1. Let _fractionalSecondDigits_ be _format_.[[fractionalSecondDigits]]. 1. Let _nf3Options_ be OrdinaryObjectCreate(*null*). 1. Perform ! CreateDataPropertyOrThrow(_nf3Options_, *"minimumIntegerDigits"*, 𝔽(_fractionalSecondDigits_)). 1. Perform ! CreateDataPropertyOrThrow(_nf3Options_, *"useGrouping"*, *false*). - 1. Let _nf3_ be ! Construct(%Intl.NumberFormat%, « _locale_, _nf3Options_ »). - 1. Let _tm_ be ToLocalTime(ℤ(ℝ(_x_) × 106)_epochNanoseconds_, _dateTimeFormat_.[[Calendar]], _dateTimeFormat_.[[TimeZone]]). + 1. Let _nf3_ be ! Construct(%Intl.NumberFormat%, « _locale_, _nf3Options_ »). + 1. Let _tm_ be ToLocalTime(ℤ(ℝ(_x_) × 106)_epochNanoseconds_, _dateTimeFormat_.[[Calendar]], _dateTimeFormat_.[[TimeZone]]). 1. Let _patternParts_ be PartitionPattern(_pattern_). 1. Let _result_ be a new empty List. 1. For each Record { [[Type]], [[Value]] } _patternPart_ of _patternParts_, do @@ -956,7 +956,7 @@

    1. Else if _p_ is *"fractionalSecondDigits"*, then 1. Assert: _format_ has a field [[fractionalSecondDigits]]. 1. Let _v_ be _tm_.[[Millisecond]]. - 1. Set _v_ to floor(_v_ × 10( _fractionalSecondDigits_ - 3 )). + 1. Set _v_ to floor(_v_ × 10( _fractionalSecondDigits_ - 3 )). 1. Let _fv_ be FormatNumeric(_nf3_, _v_). 1. Append the Record { [[Type]]: *"fractionalSecond"*, [[Value]]: _fv_ } to _result_. 1. Else if _p_ is *"dayPeriod"*, then @@ -974,7 +974,7 @@

    1. Assert: _format_ has a field [[<_p_>]]. 1. Let _f_ be _format_.[[<_p_>]]. 1. Let _v_ be the value of _tm_'s field whose name is the Internal Slot column of the matching row. - 1. If _p_ is *"year"* and _v_ ≤ 0, set _v_ to 1 - _v_. + 1. If _p_ is *"year"* and _v_ ≤ 0, set _v_ to 1 - _v_. 1. If _p_ is *"month"*, set _v_ to _v_ + 1. 1. If _p_ is *"hour"* and _dateTimeFormat_.[[HourCycle]] is *"h11"* or *"h12"*, then 1. Set _v_ to _v_ modulo 12. @@ -990,7 +990,7 @@

    1. If _count_ > 2, then 1. Let _tens_ be _codePoints_[_count_ - 2]. 1. Let _ones_ be _codePoints_[_count_ - 1]. - 1. Set _fv_ to CodePointsToString(« _tens_, _ones_ »). + 1. Set _fv_ to CodePointsToString(« _tens_, _ones_ »). 1. Else if _f_ is *"narrow"*, *"short"*, or *"long"*, then 1. Let _fv_ be a String value representing _v_ in the form given by _f_; the String value depends upon the implementation and the effective locale and calendar of _dateTimeFormat_. If _p_ is *"month"*, then the String value may also depend on whether _format_.[[day]] is present. If the implementation does not have a localized representation of _f_, then use the String value of _v_ itself. 1. Append the Record { [[Type]]: _p_, [[Value]]: _fv_ } to _result_. @@ -1106,8 +1106,8 @@

    1. If SameTemporalType(_x_, _y_) is *false*, throw a *TypeError* exception. 1. Let _xFormatRecord_ be ? HandleDateTimeValue(_dateTimeFormat_, _x_). 1. Let _yFormatRecord_ be ? HandleDateTimeValue(_dateTimeFormat_, _y_). - 1. Let _tm1_ be ToLocalTime(ℤ(ℝ(_x_) × 106)_xFormatRecord_.[[EpochNanoseconds]], _dateTimeFormat_.[[Calendar]], _dateTimeFormat_.[[TimeZone]]). - 1. Let _tm2_ be ToLocalTime(ℤ(ℝ(_y_) × 106)_yFormatRecord_.[[EpochNanoseconds]], _dateTimeFormat_.[[Calendar]], _dateTimeFormat_.[[TimeZone]]). + 1. Let _tm1_ be ToLocalTime(ℤ(ℝ(_x_) × 106)_xFormatRecord_.[[EpochNanoseconds]], _dateTimeFormat_.[[Calendar]], _dateTimeFormat_.[[TimeZone]]). + 1. Let _tm2_ be ToLocalTime(ℤ(ℝ(_y_) × 106)_yFormatRecord_.[[EpochNanoseconds]], _dateTimeFormat_.[[Calendar]], _dateTimeFormat_.[[TimeZone]]). 1. Let _format_ be _dateTimeFormat_.[[DateTimeFormat]]. 1. Let _format_ be _xFormatRecord_.[[Format]]. 1. Assert: _format_ is equal to _yFormatRecord_.[[Format]]. @@ -1139,8 +1139,8 @@

    1. If _fractionalSecondDigits_ is *undefined*, then 1. Set _fractionalSecondDigits_ to 3. 1. Let _exp_ be _fractionalSecondDigits_ - 3. - 1. Let _v1_ be floor(_tm1_.[[Millisecond]] × 10_exp_). - 1. Let _v2_ be floor(_tm2_.[[Millisecond]] × 10_exp_). + 1. Let _v1_ be floor(_tm1_.[[Millisecond]] × 10_exp_). + 1. Let _v2_ be floor(_tm2_.[[Millisecond]] × 10_exp_). 1. Else, 1. Let _v1_ be _tm1_'s field whose name is _fieldName_. 1. Let _v2_ be _tm2_'s field whose name is _fieldName_. @@ -1448,7 +1448,7 @@

    1. Set _x_ to TimeClip(_x_). 1. If _x_ is *NaN*, throw a *RangeError* exception. - 1. Let _epochNanoseconds_ be ℤ(ℝ(_x_) × 106). + 1. Let _epochNanoseconds_ be ℤ(ℝ(_x_) × 106). 1. Let _format_ be _dateTimeFormat_.[[DateTimeFormat]]. 1. Return Value Format Record { [[Format]]: _format_, diff --git a/spec/mainadditions.html b/spec/mainadditions.html index 8d28c2ff9a..650f0b6016 100644 --- a/spec/mainadditions.html +++ b/spec/mainadditions.html @@ -69,7 +69,7 @@

    The Year-Week Record Specification Type

    Mathematical Operations

    [...]

    -

    The notation “_x_ modulo _y_” (_y_ must be finite and non-zero) computes a value _k_ of the same sign as _y_ (or zero) such that abs(_k_) < abs(_y_) and _x_ - _k_ = _q_ × _y_ for some integer _q_.

    +

    The notation “_x_ modulo _y_” (_y_ must be finite and non-zero) computes a value _k_ of the same sign as _y_ (or zero) such that abs(_k_) < abs(_y_) and _x_ - _k_ = _q_ × _y_ for some integer _q_.

    The mathematical function remainder(_x_, _y_) produces the mathematical value whose sign is the sign of _x_ and whose magnitude is abs(_x_) modulo _y_.

    [...]

    Mathematical functions min, max, abs, remainder, floor, and truncate are not defined for Numbers and BigInts, and any usage of those methods that have non-mathematical value arguments would be an editorial error in this specification.

    @@ -568,7 +568,7 @@

    Date.prototype.toTemporalInstant ( )

    1. Let _dateObject_ be the *this* value. 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). 1. Let _t_ be _dateObject_.[[DateValue]]. - 1. Let _ns_ be ? NumberToBigInt(_t_) × ℤ(106). + 1. Let _ns_ be ? NumberToBigInt(_t_) × ℤ(106). 1. Return ! CreateTemporalInstant(_ns_).
    diff --git a/spec/plaindate.html b/spec/plaindate.html index db410f31b2..6292a2ab19 100644 --- a/spec/plaindate.html +++ b/spec/plaindate.html @@ -483,9 +483,9 @@

    Temporal.PlainDate.prototype.equals ( _other_ )

    1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Set _other_ to ? ToTemporalDate(_other_). - 1. If _temporalDate_.[[ISOYear]] ≠ _other_.[[ISOYear]], return *false*. - 1. If _temporalDate_.[[ISOMonth]] ≠ _other_.[[ISOMonth]], return *false*. - 1. If _temporalDate_.[[ISODay]] ≠ _other_.[[ISODay]], return *false*. + 1. If _temporalDate_.[[ISOYear]] ≠ _other_.[[ISOYear]], return *false*. + 1. If _temporalDate_.[[ISOMonth]] ≠ _other_.[[ISOMonth]], return *false*. + 1. If _temporalDate_.[[ISODay]] ≠ _other_.[[ISODay]], return *false*. 1. Return ? CalendarEquals(_temporalDate_.[[Calendar]], _other_.[[Calendar]]).
    @@ -819,7 +819,7 @@

    1. Assert: IsValidISODate(_y2_, _m2_, _d2_). 1. Let _comparison_ be CompareISODate(_y1_, _m1_, _d1_, _y2_, _m2_, _d2_). - 1. If _sign_ × _comparison_ = 1, return *true*. + 1. If _sign_ × _comparison_ = 1, return *true*. 1. Return *false*. @@ -867,14 +867,14 @@

    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 BalanceISODate(_constrained_.[[Year]], _constrained_.[[Month]], _constrained_.[[Day]] + 7 × _candidateWeeks_). 1. Repeat, while ISODateSurpasses(_sign_, _intermediate_.[[Year]], _intermediate_.[[Month]], _intermediate_.[[Day]], _y2_, _m2_, _d2_) 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 BalanceISODate(_intermediate_.[[Year]], _intermediate_.[[Month]], _intermediate_.[[Day]] + 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 BalanceISODate(_constrained_.[[Year]], _constrained_.[[Month]], _constrained_.[[Day]] + 7 × _weeks_ + _candidateDays_). 1. Repeat, while ISODateSurpasses(_sign_, _intermediate_.[[Year]], _intermediate_.[[Month]], _intermediate_.[[Day]], _y2_, _m2_, _d2_) is *false*, 1. Set _days_ to _candidateDays_. 1. Set _candidateDays_ to _candidateDays_ + _sign_. @@ -999,7 +999,7 @@

    It returns a String representation of _y_ suitable for inclusion in an ISO 8601 string, either in 4-digit format or 6-digit format with sign.
    - 1. If _y_ ≥ 0 and _y_ ≤ 9999, then + 1. If _y_ ≥ 0 and _y_ ≤ 9999, then 1. Return ToZeroPaddedDecimalString(_y_, 4). 1. If _y_ > 0, let _yearSign_ be *"+"*; otherwise, let _yearSign_ be *"-"*. 1. Let _year_ be ToZeroPaddedDecimalString(abs(_y_), 6). @@ -1051,7 +1051,7 @@

    1. Assert: IsValidISODate(_year_, _month_, _day_) is *true*. 1. Let _intermediate_ be BalanceISOYearMonth(_year_ + _years_, _month_ + _months_). 1. Set _intermediate_ to ? RegulateISODate(_intermediate_.[[Year]], _intermediate_.[[Month]], _day_, _overflow_). - 1. Set _days_ to _days_ + 7 × _weeks_. + 1. Set _days_ to _days_ + 7 × _weeks_. 1. Let _d_ be _intermediate_.[[Day]] + _days_. 1. Return BalanceISODate(_intermediate_.[[Year]], _intermediate_.[[Month]], _d_). @@ -1076,7 +1076,7 @@

    1. Assert: CalendarMethodsRecordHasLookedUp(_calendarRec_, ~date-add~) is *true*. 1. If _options_ is not present, set _options_ to *undefined*. - 1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, then + 1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, then 1. Return ? CalendarDateAdd(_calendarRec_, _plainDate_, _duration_, _options_). 1. Let _overflow_ be ? GetTemporalOverflowOption(_options_). 1. Let _norm_ be NormalizeTimeDuration(_duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). @@ -1132,7 +1132,7 @@

    1. Set _other_ to ? ToTemporalDate(_other_). 1. If ? CalendarEquals(_temporalDate_.[[Calendar]], _other_.[[Calendar]]) is *false*, throw a *RangeError* exception. 1. Let _resolvedOptions_ be ? SnapshotOwnProperties(? GetOptionsObject(_options_), *null*). - 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~date~, « », *"day"*, *"day"*). + 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~date~, « », *"day"*, *"day"*). 1. If _temporalDate_.[[ISOYear]] = _other_.[[ISOYear]], and _temporalDate_.[[ISOMonth]] = _other_.[[ISOMonth]], and _temporalDate_.[[ISODay]] = _other_.[[ISODay]], then 1. Return ! CreateTemporalDuration(0, 0, 0, 0, 0, 0, 0, 0, 0, 0). 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_temporalDate_.[[Calendar]], « ~date-add~, ~date-until~ »). @@ -1144,7 +1144,7 @@

    1. Let _destEpochNs_ be GetUTCEpochNanoseconds(_other_.[[ISOYear]], _other_.[[ISOMonth]], _other_.[[ISODay]], 0, 0, 0, 0, 0, 0). 1. Let _dateTime_ be ISO Date-Time Record { [[Year]]: _temporalDate_.[[ISOYear]], [[Month]]: _temporalDate_.[[ISOMonth]], [[Day]]: _temporalDate_.[[ISODay]], [[Hour]]: 0, [[Minute]]: 0, [[Second]]: 0, [[Millisecond]]: 0, [[Microsecond]]: 0, [[Nanosecond]]: 0 }. 1. Set _duration_ to ? RoundRelativeDuration(_duration_, _destEpochNs_, _dateTime_, _calendarRec_, ~unset~, _settings_.[[LargestUnit]], _settings_.[[RoundingIncrement]], _settings_.[[SmallestUnit]], _settings_.[[RoundingMode]]). - 1. Return ! CreateTemporalDuration(_sign_ × _duration_.[[Years]], _sign_ × _duration_.[[Months]], _sign_ × _duration_.[[Weeks]], _sign_ × _duration_.[[Days]], 0, 0, 0, 0, 0, 0). + 1. Return ! CreateTemporalDuration(_sign_ × _duration_.[[Years]], _sign_ × _duration_.[[Months]], _sign_ × _duration_.[[Weeks]], _sign_ × _duration_.[[Days]], 0, 0, 0, 0, 0, 0). diff --git a/spec/plaindatetime.html b/spec/plaindatetime.html index 73e5cb47a8..3ccc12b842 100644 --- a/spec/plaindatetime.html +++ b/spec/plaindatetime.html @@ -913,7 +913,7 @@

    - Temporal.PlainDateTime objects can represent points in time within 24 hours (8.64 × 1013 nanoseconds) of the Temporal.Instant boundaries. + Temporal.PlainDateTime objects can represent points in time within 24 hours (8.64 × 1013 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.

    @@ -921,9 +921,9 @@

    1. Assert: IsValidISODate(_year_, _month_, _day_) is *true*. 1. If abs(ISODateToEpochDays(_year_, _month_ - 1, _day_)) > 108 + 1, return *false*. 1. Let _ns_ be ℝ(GetUTCEpochNanoseconds(_year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_)). - 1. If _ns_ ≤ nsMinInstant - nsPerDay, then + 1. If _ns_ ≤ nsMinInstant - nsPerDay, then 1. Return *false*. - 1. If _ns_ ≥ nsMaxInstant + nsPerDay, then + 1. If _ns_ ≥ nsMaxInstant + nsPerDay, then 1. Return *false*. 1. Return *true*. @@ -1109,7 +1109,7 @@

    1. Let _yearString_ be PadISOYear(_isoYear_). 1. Let _monthString_ be ToZeroPaddedDecimalString(_isoMonth_, 2). 1. Let _dayString_ be ToZeroPaddedDecimalString(_isoDay_, 2). - 1. Let _subSecondNanoseconds_ be _millisecond_ × 106 + _microsecond_ × 103 + _nanosecond_. + 1. Let _subSecondNanoseconds_ be _millisecond_ × 106 + _microsecond_ × 103 + _nanosecond_. 1. Let _timeString_ be FormatTimeString(_hour_, _minute_, _second_, _subSecondNanoseconds_, _precision_). 1. Let _calendarString_ be ? MaybeFormatCalendarAnnotation(_calendar_, _showCalendar_). 1. Return the string-concatenation of _yearString_, the code unit 0x002D (HYPHEN-MINUS), _monthString_, the code unit 0x002D (HYPHEN-MINUS), _dayString_, 0x0054 (LATIN CAPITAL LETTER T), _timeString_, and _calendarString_. @@ -1278,7 +1278,7 @@

    1. Assert: ISODateTimeWithinLimits(_y1_, _mon1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_) is *true*. 1. Assert: ISODateTimeWithinLimits(_y2_, _mon2_, _d2_, _h2_, _min2_, _s2_, _ms2_, _mus2_, _ns2_) is *true*. - 1. Assert: If _y1_ ≠ _y2_, and _mon1_ ≠ _mon2_, and _d1_ ≠ _d2_, and LargerOfTwoTemporalUnits(_largestUnit_, *"day"*) is not *"day"*, CalendarMethodsRecordHasLookedUp(_calendarRec_, ~date-until~) is *true*. + 1. Assert: If _y1_ ≠ _y2_, and _mon1_ ≠ _mon2_, and _d1_ ≠ _d2_, and LargerOfTwoTemporalUnits(_largestUnit_, *"day"*) is not *"day"*, CalendarMethodsRecordHasLookedUp(_calendarRec_, ~date-until~) is *true*. 1. Let _timeDuration_ be DifferenceTime(_h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_, _h2_, _min2_, _s2_, _ms2_, _mus2_, _ns2_). 1. Let _timeSign_ be NormalizedTimeDurationSign(_timeDuration_). 1. Let _dateSign_ be CompareISODate(_y2_, _mon2_, _d2_, _y1_, _mon1_, _d1_). @@ -1370,7 +1370,7 @@

    1. Set _other_ to ? ToTemporalDateTime(_other_). 1. If ? CalendarEquals(_dateTime_.[[Calendar]], _other_.[[Calendar]]) is *false*, throw a *RangeError* exception. 1. Let _resolvedOptions_ be ? SnapshotOwnProperties(? GetOptionsObject(_options_), *null*). - 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~datetime~, « », *"nanosecond"*, *"day"*). + 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~datetime~, « », *"nanosecond"*, *"day"*). 1. Let _datePartsIdentical_ be *false*. 1. If _dateTime_.[[ISOYear]] = _other_.[[ISOYear]], and _dateTime_.[[ISOMonth]] = _other_.[[ISOMonth]], and _dateTime_.[[ISODay]] = _other_.[[ISODay]], then 1. Set _datePartsIdentical_ to *true*. @@ -1379,7 +1379,7 @@

    1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_dateTime_.[[Calendar]], « ~date-add~, ~date-until~ »). 1. Let _resultRecord_ be ? DifferencePlainDateTimeWithRounding(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _other_.[[ISOYear]], _other_.[[ISOMonth]], _other_.[[ISODay]], _other_.[[ISOHour]], _other_.[[ISOMinute]], _other_.[[ISOSecond]], _other_.[[ISOMillisecond]], _other_.[[ISOMicrosecond]], _other_.[[ISONanosecond]], _calendarRec_, _settings_.[[LargestUnit]], _settings_.[[RoundingIncrement]], _settings_.[[SmallestUnit]], _settings_.[[RoundingMode]], _resolvedOptions_). 1. Let _result_ be _resultRecord_.[[DurationRecord]]. - 1. Return ? CreateTemporalDuration(_sign_ × _result_.[[Years]], _sign_ × _result_.[[Months]], _sign_ × _result_.[[Weeks]], _sign_ × _result_.[[Days]], _sign_ × _result_.[[Hours]], _sign_ × _result_.[[Minutes]], _sign_ × _result_.[[Seconds]], _sign_ × _result_.[[Milliseconds]], _sign_ × _result_.[[Microseconds]], _sign_ × _result_.[[Nanoseconds]]). + 1. Return ? CreateTemporalDuration(_sign_ × _result_.[[Years]], _sign_ × _result_.[[Months]], _sign_ × _result_.[[Weeks]], _sign_ × _result_.[[Days]], _sign_ × _result_.[[Hours]], _sign_ × _result_.[[Minutes]], _sign_ × _result_.[[Seconds]], _sign_ × _result_.[[Milliseconds]], _sign_ × _result_.[[Microseconds]], _sign_ × _result_.[[Nanoseconds]]). @@ -1401,8 +1401,8 @@

    1. Let _duration_ be ? ToTemporalDurationRecord(_temporalDurationLike_). 1. Set _options_ to ? GetOptionsObject(_options_). 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_dateTime_.[[Calendar]], « ~date-add~ »). - 1. Let _norm_ be NormalizeTimeDuration(_sign_ × _duration_.[[Hours]], _sign_ × _duration_.[[Minutes]], _sign_ × _duration_.[[Seconds]], _sign_ × _duration_.[[Milliseconds]], _sign_ × _duration_.[[Microseconds]], _sign_ × _duration_.[[Nanoseconds]]). - 1. Let _result_ be ? AddDateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _calendarRec_, _sign_ × _duration_.[[Years]], _sign_ × _duration_.[[Months]], _sign_ × _duration_.[[Weeks]], _sign_ × _duration_.[[Days]], _norm_, _options_). + 1. Let _norm_ be NormalizeTimeDuration(_sign_ × _duration_.[[Hours]], _sign_ × _duration_.[[Minutes]], _sign_ × _duration_.[[Seconds]], _sign_ × _duration_.[[Milliseconds]], _sign_ × _duration_.[[Microseconds]], _sign_ × _duration_.[[Nanoseconds]]). + 1. Let _result_ be ? AddDateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _calendarRec_, _sign_ × _duration_.[[Years]], _sign_ × _duration_.[[Months]], _sign_ × _duration_.[[Weeks]], _sign_ × _duration_.[[Days]], _norm_, _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. Return ? CreateTemporalDateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]], _dateTime_.[[Calendar]]). diff --git a/spec/plainmonthday.html b/spec/plainmonthday.html index 945ce77fa0..903a15af56 100644 --- a/spec/plainmonthday.html +++ b/spec/plainmonthday.html @@ -166,9 +166,9 @@

    Temporal.PlainMonthDay.prototype.equals ( _other_ )

    1. Let _monthDay_ be the *this* value. 1. Perform ? RequireInternalSlot(_monthDay_, [[InitializedTemporalMonthDay]]). 1. Set _other_ to ? ToTemporalMonthDay(_other_). - 1. If _monthDay_.[[ISOMonth]] ≠ _other_.[[ISOMonth]], return *false*. - 1. If _monthDay_.[[ISODay]] ≠ _other_.[[ISODay]], return *false*. - 1. If _monthDay_.[[ISOYear]] ≠ _other_.[[ISOYear]], return *false*. + 1. If _monthDay_.[[ISOMonth]] ≠ _other_.[[ISOMonth]], return *false*. + 1. If _monthDay_.[[ISODay]] ≠ _other_.[[ISODay]], return *false*. + 1. If _monthDay_.[[ISOYear]] ≠ _other_.[[ISOYear]], return *false*. 1. Return ? CalendarEquals(_monthDay_.[[Calendar]], _other_.[[Calendar]]).
    diff --git a/spec/plaintime.html b/spec/plaintime.html index 3b53cfdcbb..5448ac310a 100644 --- a/spec/plaintime.html +++ b/spec/plaintime.html @@ -311,12 +311,12 @@

    Temporal.PlainTime.prototype.equals ( _other_ )

    1. Let _temporalTime_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalTime_, [[InitializedTemporalTime]]). 1. Set _other_ to ? ToTemporalTime(_other_). - 1. If _temporalTime_.[[ISOHour]] ≠ _other_.[[ISOHour]], return *false*. - 1. If _temporalTime_.[[ISOMinute]] ≠ _other_.[[ISOMinute]], return *false*. - 1. If _temporalTime_.[[ISOSecond]] ≠ _other_.[[ISOSecond]], return *false*. - 1. If _temporalTime_.[[ISOMillisecond]] ≠ _other_.[[ISOMillisecond]], return *false*. - 1. If _temporalTime_.[[ISOMicrosecond]] ≠ _other_.[[ISOMicrosecond]], return *false*. - 1. If _temporalTime_.[[ISONanosecond]] ≠ _other_.[[ISONanosecond]], return *false*. + 1. If _temporalTime_.[[ISOHour]] ≠ _other_.[[ISOHour]], return *false*. + 1. If _temporalTime_.[[ISOMinute]] ≠ _other_.[[ISOMinute]], return *false*. + 1. If _temporalTime_.[[ISOSecond]] ≠ _other_.[[ISOSecond]], return *false*. + 1. If _temporalTime_.[[ISOMillisecond]] ≠ _other_.[[ISOMillisecond]], return *false*. + 1. If _temporalTime_.[[ISOMicrosecond]] ≠ _other_.[[ISOMicrosecond]], return *false*. + 1. If _temporalTime_.[[ISONanosecond]] ≠ _other_.[[ISONanosecond]], return *false*. 1. Return *true*.
    @@ -508,7 +508,7 @@

    Time Records

    [[Days]] - an integer ≥ 0 + an integer ≥ 0 A number of overflow days. @@ -909,7 +909,7 @@

    It formats the given time as an ISO 8601 string, to the precision specified by _precision_.
    - 1. Let _subSecondNanoseconds_ be _millisecond_ × 106 + _microsecond_ × 103 + _nanosecond_. + 1. Let _subSecondNanoseconds_ be _millisecond_ × 106 + _microsecond_ × 103 + _nanosecond_. 1. Return FormatTimeString(_hour_, _minute_, _second_, _subSecondNanoseconds_, _precision_). @@ -995,20 +995,20 @@

    1. If _unit_ is *"day"* or *"hour"*, then - 1. Let _quantity_ be ((((_hour_ × 60 + _minute_) × 60 + _second_) × 1000 + _millisecond_) × 1000 + _microsecond_) × 1000 + _nanosecond_. + 1. Let _quantity_ be ((((_hour_ × 60 + _minute_) × 60 + _second_) × 1000 + _millisecond_) × 1000 + _microsecond_) × 1000 + _nanosecond_. 1. Else if _unit_ is *"minute"*, then - 1. Let _quantity_ be (((_minute_ × 60 + _second_) × 1000 + _millisecond_) × 1000 + _microsecond_) × 1000 + _nanosecond_. + 1. Let _quantity_ be (((_minute_ × 60 + _second_) × 1000 + _millisecond_) × 1000 + _microsecond_) × 1000 + _nanosecond_. 1. Else if _unit_ is *"second"*, then - 1. Let _quantity_ be ((_second_ × 1000 + _millisecond_) × 1000 + _microsecond_) × 1000 + _nanosecond_. + 1. Let _quantity_ be ((_second_ × 1000 + _millisecond_) × 1000 + _microsecond_) × 1000 + _nanosecond_. 1. Else if _unit_ is *"millisecond"*, then - 1. Let _quantity_ be (_millisecond_ × 1000 + _microsecond_) × 1000 + _nanosecond_. + 1. Let _quantity_ be (_millisecond_ × 1000 + _microsecond_) × 1000 + _nanosecond_. 1. Else if _unit_ is *"microsecond"*, then - 1. Let _quantity_ be _microsecond_ × 1000 + _nanosecond_. + 1. Let _quantity_ be _microsecond_ × 1000 + _nanosecond_. 1. Else, 1. Assert: _unit_ is *"nanosecond"*. 1. Let _quantity_ be _nanosecond_. 1. Let _unitLength_ be the value in the "Length in Nanoseconds" column of the row of whose "Singular" column contains _unit_. - 1. Let _result_ be RoundNumberToIncrement(_quantity_, _increment_ × _unitLength_, _roundingMode_) / _unitLength_. + 1. Let _result_ be RoundNumberToIncrement(_quantity_, _increment_ × _unitLength_, _roundingMode_) / _unitLength_. 1. If _unit_ is *"day"*, then 1. Return Time Record { [[Days]]: _result_, @@ -1051,13 +1051,13 @@

    1. If _operation_ is ~since~, let _sign_ be -1. Otherwise, let _sign_ be 1. 1. Set _other_ to ? ToTemporalTime(_other_). 1. Let _resolvedOptions_ be ? SnapshotOwnProperties(? GetOptionsObject(_options_), *null*). - 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~time~, « », *"nanosecond"*, *"hour"*). + 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~time~, « », *"nanosecond"*, *"hour"*). 1. Let _norm_ be DifferenceTime(_temporalTime_.[[ISOHour]], _temporalTime_.[[ISOMinute]], _temporalTime_.[[ISOSecond]], _temporalTime_.[[ISOMillisecond]], _temporalTime_.[[ISOMicrosecond]], _temporalTime_.[[ISONanosecond]], _other_.[[ISOHour]], _other_.[[ISOMinute]], _other_.[[ISOSecond]], _other_.[[ISOMillisecond]], _other_.[[ISOMicrosecond]], _other_.[[ISONanosecond]]). - 1. If _settings_.[[SmallestUnit]] is not *"nanosecond"* or _settings_.[[RoundingIncrement]] ≠ 1, then + 1. If _settings_.[[SmallestUnit]] is not *"nanosecond"* or _settings_.[[RoundingIncrement]] ≠ 1, then 1. Let _roundRecord_ be ! RoundTimeDuration(0, _norm_, _settings_.[[RoundingIncrement]], _settings_.[[SmallestUnit]], _settings_.[[RoundingMode]]). 1. Set _norm_ to _roundRecord_.[[NormalizedDuration]].[[NormalizedTime]]. 1. Let _result_ be ! BalanceTimeDuration(_norm_, _settings_.[[LargestUnit]]). - 1. Return ! CreateTemporalDuration(0, 0, 0, 0, _sign_ × _result_.[[Hours]], _sign_ × _result_.[[Minutes]], _sign_ × _result_.[[Seconds]], _sign_ × _result_.[[Milliseconds]], _sign_ × _result_.[[Microseconds]], _sign_ × _result_.[[Nanoseconds]]). + 1. Return ! CreateTemporalDuration(0, 0, 0, 0, _sign_ × _result_.[[Hours]], _sign_ × _result_.[[Minutes]], _sign_ × _result_.[[Seconds]], _sign_ × _result_.[[Milliseconds]], _sign_ × _result_.[[Microseconds]], _sign_ × _result_.[[Nanoseconds]]). @@ -1076,7 +1076,7 @@

    1. If _operation_ is ~subtract~, let _sign_ be -1. Otherwise, let _sign_ be 1. 1. Let _duration_ be ? ToTemporalDurationRecord(_temporalDurationLike_). - 1. Let _norm_ be NormalizeTimeDuration(_sign_ × _duration_.[[Hours]], _sign_ × _duration_.[[Minutes]], _sign_ × _duration_.[[Seconds]], _sign_ × _duration_.[[Milliseconds]], _sign_ × _duration_.[[Microseconds]], _sign_ × _duration_.[[Nanoseconds]]). + 1. Let _norm_ be NormalizeTimeDuration(_sign_ × _duration_.[[Hours]], _sign_ × _duration_.[[Minutes]], _sign_ × _duration_.[[Seconds]], _sign_ × _duration_.[[Milliseconds]], _sign_ × _duration_.[[Microseconds]], _sign_ × _duration_.[[Nanoseconds]]). 1. Let _result_ be AddTime(_temporalTime_.[[ISOHour]], _temporalTime_.[[ISOMinute]], _temporalTime_.[[ISOSecond]], _temporalTime_.[[ISOMillisecond]], _temporalTime_.[[ISOMicrosecond]], _temporalTime_.[[ISONanosecond]], _norm_). 1. Return ! CreateTemporalTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]). diff --git a/spec/plainyearmonth.html b/spec/plainyearmonth.html index 1652c76307..73fa89f047 100644 --- a/spec/plainyearmonth.html +++ b/spec/plainyearmonth.html @@ -326,9 +326,9 @@

    Temporal.PlainYearMonth.prototype.equals ( _other_ )

    1. Let _yearMonth_ be the *this* value. 1. Perform ? RequireInternalSlot(_yearMonth_, [[InitializedTemporalYearMonth]]). 1. Set _other_ to ? ToTemporalYearMonth(_other_). - 1. If _yearMonth_.[[ISOYear]] ≠ _other_.[[ISOYear]], return *false*. - 1. If _yearMonth_.[[ISOMonth]] ≠ _other_.[[ISOMonth]], return *false*. - 1. If _yearMonth_.[[ISODay]] ≠ _other_.[[ISODay]], return *false*. + 1. If _yearMonth_.[[ISOYear]] ≠ _other_.[[ISOYear]], return *false*. + 1. If _yearMonth_.[[ISOMonth]] ≠ _other_.[[ISOMonth]], return *false*. + 1. If _yearMonth_.[[ISODay]] ≠ _other_.[[ISODay]], return *false*. 1. Return ? CalendarEquals(_yearMonth_.[[Calendar]], _other_.[[Calendar]]).
    @@ -719,7 +719,7 @@

    1. Let _calendar_ be _yearMonth_.[[Calendar]]. 1. If ? CalendarEquals(_calendar_, _other_.[[Calendar]]) is *false*, throw a *RangeError* exception. 1. Let _resolvedOptions_ be ? SnapshotOwnProperties(? GetOptionsObject(_options_), *null*). - 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~date~, « *"week"*, *"day"* », *"month"*, *"year"*). + 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~date~, « *"week"*, *"day"* », *"month"*, *"year"*). 1. If _yearMonth_.[[ISOYear]] = _other_.[[ISOYear]] and _yearMonth_.[[ISOMonth]] = _other_.[[ISOMonth]] and _yearMonth_.[[ISODay]] = _other_.[[ISODay]], then 1. Return ! CreateTemporalDuration(0, 0, 0, 0, 0, 0, 0, 0, 0, 0). 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_calendar_, « ~date-add~, ~date-from-fields~, ~date-until~, ~fields~ »). @@ -732,11 +732,11 @@

    1. Perform ! CreateDataPropertyOrThrow(_resolvedOptions_, *"largestUnit"*, _settings_.[[LargestUnit]]). 1. Let _result_ be ? CalendarDateUntil(_calendarRec_, _thisDate_, _otherDate_, _resolvedOptions_). 1. Let _duration_ be ! CreateNormalizedDurationRecord(_result_.[[Years]], _result_.[[Months]], 0, 0, ZeroTimeDuration()). - 1. If _settings_.[[SmallestUnit]] is not *"month"* or _settings_.[[RoundingIncrement]] ≠ 1, then + 1. If _settings_.[[SmallestUnit]] is not *"month"* or _settings_.[[RoundingIncrement]] ≠ 1, then 1. Let _destEpochNs_ be GetUTCEpochNanoseconds(_otherDate_.[[ISOYear]], _otherDate_.[[ISOMonth]], _otherDate_.[[ISODay]], 0, 0, 0, 0, 0, 0). 1. Let _dateTime_ be ISO Date-Time Record { [[Year]]: _thisDate_.[[ISOYear]], [[Month]]: _thisDate_.[[ISOMonth]], [[Day]]: _thisDate_.[[ISODay]], [[Hour]]: 0, [[Minute]]: 0, [[Second]]: 0, [[Millisecond]]: 0, [[Microsecond]]: 0, [[Nanosecond]]: 0 }. 1. Set _duration_ to ? RoundRelativeDuration(_duration_, _destEpochNs_, _dateTime_, _calendarRec_, ~unset~, _settings_.[[LargestUnit]], _settings_.[[RoundingIncrement]], _settings_.[[SmallestUnit]], _settings_.[[RoundingMode]]). - 1. Return ! CreateTemporalDuration(_sign_ × _duration_.[[Years]], _sign_ × _duration_.[[Months]], 0, 0, 0, 0, 0, 0, 0, 0). + 1. Return ! CreateTemporalDuration(_sign_ × _duration_.[[Years]], _sign_ × _duration_.[[Months]], 0, 0, 0, 0, 0, 0, 0, 0). diff --git a/spec/timezone.html b/spec/timezone.html index fa0ad251a9..01a48be6d0 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -561,7 +561,7 @@

    The returned value _t_ represents the number of nanoseconds since the epoch that corresponds to the first time zone transition after _epochNanoseconds_ in the IANA time zone identified by _timeZoneIdentifier_. - The operation returns *null* if no such transition exists for which _t_ ≤ ℤ(nsMaxInstant). + The operation returns *null* if no such transition exists for which _t_ ≤ ℤ(nsMaxInstant).

    A transition is a point in time where the UTC offset of a time zone changes, for example when Daylight Saving Time starts or stops. @@ -590,7 +590,7 @@

    The returned value _t_ represents the number of nanoseconds since the epoch that corresponds to the last time zone transition before _epochNanoseconds_ in the IANA time zone identified by _timeZoneIdentifier_. - The operation returns *null* if no such transition exists for which _t_ ≥ ℤ(nsMinInstant). + The operation returns *null* if no such transition exists for which _t_ ≥ ℤ(nsMinInstant).

    A transition is a point in time where the UTC offset of a time zone changes, for example when Daylight Saving Time starts or stops. @@ -624,7 +624,7 @@

    - 1. If _offsetMinutes_ ≥ 0, let _sign_ be the code unit 0x002B (PLUS SIGN); otherwise, let _sign_ be the code unit 0x002D (HYPHEN-MINUS). + 1. If _offsetMinutes_ ≥ 0, let _sign_ be the code unit 0x002B (PLUS SIGN); otherwise, let _sign_ be the code unit 0x002D (HYPHEN-MINUS). 1. Let _absoluteMinutes_ be abs(_offsetMinutes_). 1. Let _hour_ be floor(_absoluteMinutes_ / 60). 1. Let _minute_ be _absoluteMinutes_ modulo 60. @@ -647,7 +647,7 @@

    - 1. If _offsetNanoseconds_ ≥ 0, let _sign_ be the code unit 0x002B (PLUS SIGN); otherwise, let _sign_ be the code unit 0x002D (HYPHEN-MINUS). + 1. If _offsetNanoseconds_ ≥ 0, let _sign_ be the code unit 0x002B (PLUS SIGN); otherwise, let _sign_ be the code unit 0x002D (HYPHEN-MINUS). 1. Let _absoluteNanoseconds_ be abs(_offsetNanoseconds_). 1. Let _hour_ be floor(_absoluteNanoseconds_ / (3600 × 109)). 1. Let _minute_ be floor(_absoluteNanoseconds_ / (60 × 109)) modulo 60. @@ -785,7 +785,7 @@

    1. If _offsetNanoseconds_ is not a Number, throw a *TypeError* exception. 1. If IsIntegralNumber(_offsetNanoseconds_) is *false*, throw a *RangeError* exception. 1. Set _offsetNanoseconds_ to ℝ(_offsetNanoseconds_). - 1. If abs(_offsetNanoseconds_) ≥ nsPerDay, throw a *RangeError* exception. + 1. If abs(_offsetNanoseconds_) ≥ nsPerDay, throw a *RangeError* exception. 1. Return _offsetNanoseconds_. @@ -883,7 +883,7 @@

    1. Let _n_ be _possibleInstants_'s length. 1. If _n_ = 1, then 1. Return _possibleInstants_[0]. - 1. If _n_ ≠ 0, then + 1. If _n_ ≠ 0, then 1. If _disambiguation_ is *"earlier"* or *"compatible"*, then 1. Return _possibleInstants_[0]. 1. If _disambiguation_ is *"later"*, then diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index 3d40d30fee..5222343066 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -465,7 +465,7 @@

    get Temporal.ZonedDateTime.prototype.hoursInDay

    1. Let _todayInstant_ be ? GetInstantFor(_timeZoneRec_, _today_, *"compatible"*). 1. Let _tomorrowInstant_ be ? GetInstantFor(_timeZoneRec_, _tomorrow_, *"compatible"*). 1. Let _diff_ be NormalizedTimeDurationFromEpochNanosecondsDifference(_tomorrowInstant_.[[Nanoseconds]], _todayInstant_.[[Nanoseconds]]). - 1. Return 𝔽(DivideNormalizedTimeDuration(_diff_, 3.6 × 1012)). + 1. Return 𝔽(DivideNormalizedTimeDuration(_diff_, 3.6 × 1012)).
    @@ -761,7 +761,7 @@

    Temporal.ZonedDateTime.prototype.round ( _roundTo_ )

    1. If _thisNs_ < _startNs_, throw a *RangeError* exception. 1. Let _instantEnd_ be ? GetInstantFor(_timeZoneRec_, _dtEnd_, *"compatible"*). 1. Let _endNs_ be _instantEnd_.[[Nanoseconds]]. - 1. If _thisNs_ ≥ _endNs_, throw a *RangeError* exception. + 1. If _thisNs_ ≥ _endNs_, throw a *RangeError* exception. 1. Let _dayLengthNs_ be ℝ(_endNs_ - _startNs_). 1. Let _dayProgressNs_ be NormalizedTimeDurationFromEpochNanosecondsDifference(_thisNs_, _startNs_). 1. Let _roundedDayNs_ be ! RoundNormalizedTimeDurationToIncrement(_dayProgressNs_, _dayLengthNs_, _roundingMode_). @@ -782,7 +782,7 @@

    Temporal.ZonedDateTime.prototype.equals ( _other_ )

    1. Let _zonedDateTime_ be the *this* value. 1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]). 1. Set _other_ to ? ToTemporalZonedDateTime(_other_). - 1. If _zonedDateTime_.[[Nanoseconds]] ≠ _other_.[[Nanoseconds]], return *false*. + 1. If _zonedDateTime_.[[Nanoseconds]] ≠ _other_.[[Nanoseconds]], return *false*. 1. If ? TimeZoneEquals(_zonedDateTime_.[[TimeZone]], _other_.[[TimeZone]]) is *false*, return *false*. 1. Return ? CalendarEquals(_zonedDateTime_.[[Calendar]], _other_.[[Calendar]]).
    @@ -1106,7 +1106,7 @@

    1. If _candidateNanoseconds_ = _offsetNanoseconds_, then 1. Return _candidate_.[[Nanoseconds]]. 1. If _matchBehaviour_ is ~match-minutes~, then - 1. Let _roundedCandidateNanoseconds_ be RoundNumberToIncrement(_candidateNanoseconds_, 60 × 109, *"halfExpand"*). + 1. Let _roundedCandidateNanoseconds_ be RoundNumberToIncrement(_candidateNanoseconds_, 60 × 109, *"halfExpand"*). 1. If _roundedCandidateNanoseconds_ = _offsetNanoseconds_, then 1. Return _candidate_.[[Nanoseconds]]. 1. If _offsetOption_ is *"reject"*, throw a *RangeError* exception. @@ -1363,14 +1363,14 @@

    1. Let _timeDuration_ be DifferenceTime(_startDateTime_.[[ISOHour]], _startDateTime_.[[ISOMinute]], _startDateTime_.[[ISOSecond]], _startDateTime_.[[ISOMillisecond]], _startDateTime_.[[ISOMicrosecond]], _startDateTime_.[[ISONanosecond]], _endDateTime_.[[ISOHour]], _endDateTime_.[[ISOMinute]], _endDateTime_.[[ISOSecond]], _endDateTime_.[[ISOMillisecond]], _endDateTime_.[[ISOMicrosecond]], _endDateTime_.[[ISONanosecond]]). 1. If NormalizedTimeDurationSign(_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_.[[ISOYear]], _endDateTime_.[[ISOMonth]], _endDateTime_.[[ISODay]] - _dayCorrection_ × _sign_). + 1. Repeat, while _dayCorrection_ ≤ _maxDayCorrection_ and _success_ is *false*, + 1. Let _intermediateDate_ be BalanceISODate(_endDateTime_.[[ISOYear]], _endDateTime_.[[ISOMonth]], _endDateTime_.[[ISODay]] - _dayCorrection_ × _sign_). 1. Let _intermediateDateTime_ be ! CreateTemporalDateTime(_intermediateDate_.[[Year]], _intermediateDate_.[[Month]], _intermediateDate_.[[Day]], _startDateTime_.[[ISOHour]], _startDateTime_.[[ISOMinute]], _startDateTime_.[[ISOSecond]], _startDateTime_.[[ISOMillisecond]], _startDateTime_.[[ISOMicrosecond]], _startDateTime_.[[ISONanosecond]], _calendarRec_.[[Receiver]]). 1. Let _intermediateInstant_ be ? GetInstantFor(_timeZoneRec_, _intermediateDateTime_, *"compatible"*). 1. Let _intermediateNs_ be _intermediateInstant_.[[Nanoseconds]]. 1. Let _norm_ be NormalizedTimeDurationFromEpochNanosecondsDifference(_ns2_, _intermediateNs_). 1. Let _timeSign_ be NormalizedTimeDurationSign(_norm_). - 1. If _sign_ ≠ -_timeSign_, then + 1. If _sign_ ≠ -_timeSign_, then 1. Set _success_ to *true*. 1. Set _dayCorrection_ to _dayCorrection_ + 1. 1. If _success_ is *true*, then @@ -1443,12 +1443,12 @@

    1. If ? CalendarEquals(_zonedDateTime_.[[Calendar]], _other_.[[Calendar]]) is *false*, then 1. Throw a *RangeError* exception. 1. Let _resolvedOptions_ be ? SnapshotOwnProperties(? GetOptionsObject(_options_), *null*). - 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~datetime~, « », *"nanosecond"*, *"hour"*). + 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~datetime~, « », *"nanosecond"*, *"hour"*). 1. If _settings_.[[LargestUnit]] is not one of *"year"*, *"month"*, *"week"*, or *"day"*, then 1. Let _diffRecord_ be DifferenceInstant(_zonedDateTime_.[[Nanoseconds]], _other_.[[Nanoseconds]], _settings_.[[RoundingIncrement]], _settings_.[[SmallestUnit]], _settings_.[[RoundingMode]]). 1. Let _norm_ be _diffRecord_.[[NormalizedTimeDuration]]. 1. Let _result_ be ! BalanceTimeDuration(_norm_, _settings_.[[LargestUnit]]). - 1. Return ! CreateTemporalDuration(0, 0, 0, 0, _sign_ × _result_.[[Hours]], _sign_ × _result_.[[Minutes]], _sign_ × _result_.[[Seconds]], _sign_ × _result_.[[Milliseconds]], _sign_ × _result_.[[Microseconds]], _sign_ × _result_.[[Nanoseconds]]). + 1. Return ! CreateTemporalDuration(0, 0, 0, 0, _sign_ × _result_.[[Hours]], _sign_ × _result_.[[Minutes]], _sign_ × _result_.[[Seconds]], _sign_ × _result_.[[Milliseconds]], _sign_ × _result_.[[Microseconds]], _sign_ × _result_.[[Nanoseconds]]). 1. NOTE: To calculate differences in two different time zones, _settings_.[[LargestUnit]] must be *"hour"* or smaller, because day lengths can vary between time zones due to DST and other UTC offset shifts. 1. If ? TimeZoneEquals(_zonedDateTime_.[[TimeZone]], _other_.[[TimeZone]]) is *false*, then 1. Throw a *RangeError* exception. @@ -1460,7 +1460,7 @@

    1. Let _precalculatedPlainDateTime_ be ? GetPlainDateTimeFor(_timeZoneRec_, _instant_, _calendarRec_.[[Receiver]]). 1. Let _resultRecord_ be ? DifferenceZonedDateTimeWithRounding(_zonedDateTime_.[[Nanoseconds]], _other_.[[Nanoseconds]], _calendarRec_, _timeZoneRec_, _precalculatedPlainDateTime_, _resolvedOptions_, _settings_.[[LargestUnit]], _settings_.[[RoundingIncrement]], _settings_.[[SmallestUnit]], _settings_.[[RoundingMode]]). 1. Let _result_ be _resultRecord_.[[DurationRecord]]. - 1. Return ! CreateTemporalDuration(_sign_ × _result_.[[Years]], _sign_ × _result_.[[Months]], _sign_ × _result_.[[Weeks]], _sign_ × _result_.[[Days]], _sign_ × _result_.[[Hours]], _sign_ × _result_.[[Minutes]], _sign_ × _result_.[[Seconds]], _sign_ × _result_.[[Milliseconds]], _sign_ × _result_.[[Microseconds]], _sign_ × _result_.[[Nanoseconds]]). + 1. Return ! CreateTemporalDuration(_sign_ × _result_.[[Years]], _sign_ × _result_.[[Months]], _sign_ × _result_.[[Weeks]], _sign_ × _result_.[[Days]], _sign_ × _result_.[[Hours]], _sign_ × _result_.[[Minutes]], _sign_ × _result_.[[Seconds]], _sign_ × _result_.[[Milliseconds]], _sign_ × _result_.[[Microseconds]], _sign_ × _result_.[[Nanoseconds]]). @@ -1483,8 +1483,8 @@

    1. Set _options_ to ? GetOptionsObject(_options_). 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_zonedDateTime_.[[TimeZone]], « ~get-offset-nanoseconds-for~, ~get-possible-instants-for~ »). 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_zonedDateTime_.[[Calendar]], « ~date-add~ »). - 1. Let _norm_ be NormalizeTimeDuration(_sign_ × _duration_.[[Hours]], _sign_ × _duration_.[[Minutes]], _sign_ × _duration_.[[Seconds]], _sign_ × _duration_.[[Milliseconds]], _sign_ × _duration_.[[Microseconds]], _sign_ × _duration_.[[Nanoseconds]]). - 1. Let _epochNanoseconds_ be ? AddZonedDateTime(_zonedDateTime_.[[Nanoseconds]], _timeZoneRec_, _calendarRec_, _sign_ × _duration_.[[Years]], _sign_ × _duration_.[[Months]], _sign_ × _duration_.[[Weeks]], _sign_ × _duration_.[[Days]], _norm_, *undefined*, _options_). + 1. Let _norm_ be NormalizeTimeDuration(_sign_ × _duration_.[[Hours]], _sign_ × _duration_.[[Minutes]], _sign_ × _duration_.[[Seconds]], _sign_ × _duration_.[[Milliseconds]], _sign_ × _duration_.[[Microseconds]], _sign_ × _duration_.[[Nanoseconds]]). + 1. Let _epochNanoseconds_ be ? AddZonedDateTime(_zonedDateTime_.[[Nanoseconds]], _timeZoneRec_, _calendarRec_, _sign_ × _duration_.[[Years]], _sign_ × _duration_.[[Months]], _sign_ × _duration_.[[Weeks]], _sign_ × _duration_.[[Days]], _norm_, *undefined*, _options_). 1. Return ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZoneRec_.[[Receiver]], _calendarRec_.[[Receiver]]).