Skip to content

Commit

Permalink
Editorial: Change missing calendar error in RoundDuration to an asser…
Browse files Browse the repository at this point in the history
…tion

With the previous changes, the throwing step can no longer be reached.

Closes: #2648
  • Loading branch information
ptomato committed Apr 26, 2024
1 parent 3264454 commit c8b3168
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5379,10 +5379,6 @@ export function RoundDuration(
// dateAdd and dateUntil must be looked up
const TemporalDuration = GetIntrinsic('%Temporal.Duration%');

if (IsCalendarUnit(unit) && !plainRelativeTo) {
throw new RangeError(`A starting point is required for ${unit}s rounding`);
}

// First convert time units up to days, if rounding to days or higher units.
// If rounding relative to a ZonedDateTime, then some days may not be 24h.
let dayLengthNs;
Expand Down
2 changes: 1 addition & 1 deletion spec/duration.html
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,7 @@ <h1>
1. If _zonedRelativeTo_ is not present, set _zonedRelativeTo_ to *undefined*.
1. If _precalculatedPlainDateTime_ is not present, set _precalculatedPlainDateTime_ to *undefined*.
1. If IsCalendarUnit(_unit_) is *true*, then
1. If _plainRelativeTo_ is *undefined*, throw a *RangeError* exception.
1. Assert: _plainRelativeTo_ is not *undefined*.
1. Assert: CalendarMethodsRecordHasLookedUp(_calendarRec_, ~date-add~) is *true*.
1. Assert: CalendarMethodsRecordHasLookedUp(_calendarRec_, ~date-until~) is *true*.
1. If IsCalendarUnit(_unit_) is *true* or _unit_ is *"day"*, then
Expand Down

0 comments on commit c8b3168

Please sign in to comment.