Skip to content

Commit 05017b9

Browse files
ptomatoMs2ger
authored andcommitted
Editorial: ToDateDurationRecordWithoutTime is infallible
The input is an existing valid Temporal.Duration object, which cannot have a total of days through nanoseconds that exceeds the 2⁵³ limit. So days cannot be out of range in the CreateDateDurationRecord call. h/t Anba Closes: #3028
1 parent 76c6612 commit 05017b9

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

spec/duration.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ <h1>
909909
<h1>
910910
ToDateDurationRecordWithoutTime (
911911
_duration_: a Temporal.Duration,
912-
): either a normal completion containing a Date Duration Record, or a throw completion
912+
): a Date Duration Record
913913
</h1>
914914
<dl class="header">
915915
<dt>description</dt>
@@ -918,7 +918,7 @@ <h1>
918918
<emu-alg>
919919
1. Let _internalDuration_ be ToInternalDurationRecordWith24HourDays(_duration_).
920920
1. Let _days_ be truncate(_internalDuration_.[[Time]] / nsPerDay).
921-
1. Return ? CreateDateDurationRecord(_internalDuration_.[[Date]].[[Years]], _internalDuration_.[[Date]].[[Months]], _internalDuration_.[[Date]].[[Weeks]], _days_).
921+
1. Return ! CreateDateDurationRecord(_internalDuration_.[[Date]].[[Years]], _internalDuration_.[[Date]].[[Months]], _internalDuration_.[[Date]].[[Weeks]], _days_).
922922
</emu-alg>
923923
</emu-clause>
924924

spec/plaindate.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ <h1>
927927
1. Let _calendar_ be _temporalDate_.[[Calendar]].
928928
1. Let _duration_ be ? ToTemporalDuration(_temporalDurationLike_).
929929
1. If _operation_ is ~subtract~, set _duration_ to CreateNegatedTemporalDuration(_duration_).
930-
1. Let _dateDuration_ be ? ToDateDurationRecordWithoutTime(_duration_).
930+
1. Let _dateDuration_ be ToDateDurationRecordWithoutTime(_duration_).
931931
1. Let _resolvedOptions_ be ? GetOptionsObject(_options_).
932932
1. Let _overflow_ be ? GetTemporalOverflowOption(_resolvedOptions_).
933933
1. Let _result_ be ? CalendarDateAdd(_calendar_, _temporalDate_.[[ISODate]], _dateDuration_, _overflow_).

spec/plainyearmonth.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ <h1>
652652
1. Assert: ISODateWithinLimits(_date_) is *true*.
653653
1. Else,
654654
1. Let _date_ be _intermediateDate_.
655-
1. Let _durationToAdd_ be ? ToDateDurationRecordWithoutTime(_duration_).
655+
1. Let _durationToAdd_ be ToDateDurationRecordWithoutTime(_duration_).
656656
1. Let _addedDate_ be ? CalendarDateAdd(_calendar_, _date_, _durationToAdd_, _overflow_).
657657
1. Let _addedDateFields_ be ISODateToFields(_calendar_, _addedDate_, ~year-month~).
658658
1. Let _isoDate_ be ? CalendarYearMonthFromFields(_calendar_, _addedDateFields_, _overflow_).

0 commit comments

Comments
 (0)