Skip to content

Commit 315c890

Browse files
catamorphismptomato
authored andcommitted
Polyfill: Replace checks with assertions in BalanceISODate and BalanceISOYearMonth
I don't see a case where these would be called on Infinity.
1 parent e47f916 commit 315c890

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

polyfill/lib/ecmascript.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,7 +2630,7 @@ function InternalDurationSign(duration) {
26302630
}
26312631

26322632
export function BalanceISOYearMonth(year, month) {
2633-
if (!NumberIsFinite(year) || !NumberIsFinite(month)) throw new RangeErrorCtor('infinity is out of range');
2633+
assert(NumberIsFinite(year) && NumberIsFinite(month), 'BalanceISOYearMonth: infinity is out of range');
26342634
month -= 1;
26352635
year += MathFloor(month / 12);
26362636
month %= 12;
@@ -2640,7 +2640,7 @@ export function BalanceISOYearMonth(year, month) {
26402640
}
26412641

26422642
export function BalanceISODate(year, month, day) {
2643-
if (!NumberIsFinite(day)) throw new RangeErrorCtor('infinity is out of range');
2643+
assert(NumberIsFinite(day), 'BalanceISODate: infinity is out of range');
26442644
({ year, month } = BalanceISOYearMonth(year, month));
26452645

26462646
// The pattern of leap years in the ISO 8601 calendar repeats every 400

0 commit comments

Comments
 (0)