diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs index a653fdb0c..9e9acaac8 100644 --- a/polyfill/lib/ecmascript.mjs +++ b/polyfill/lib/ecmascript.mjs @@ -2629,7 +2629,7 @@ function InternalDurationSign(duration) { } export function BalanceISOYearMonth(year, month) { - if (!NumberIsFinite(year) || !NumberIsFinite(month)) throw new RangeErrorCtor('infinity is out of range'); + assert(NumberIsFinite(year) && NumberIsFinite(month), 'BalanceISOYearMonth: infinity is out of range'); month -= 1; year += MathFloor(month / 12); month %= 12; @@ -2639,7 +2639,7 @@ export function BalanceISOYearMonth(year, month) { } export function BalanceISODate(year, month, day) { - if (!NumberIsFinite(day)) throw new RangeErrorCtor('infinity is out of range'); + assert(NumberIsFinite(day), 'BalanceISODate: infinity is out of range'); ({ year, month } = BalanceISOYearMonth(year, month)); // The pattern of leap years in the ISO 8601 calendar repeats every 400