From fc98b724a3e5528abe6e7de092bb54c28dcb32ad Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 19 Dec 2025 20:27:05 -0800 Subject: [PATCH] Polyfill: Replace checks with assertions in BalanceISODate and BalanceISOYearMonth I don't see a case where these would be called on Infinity. --- polyfill/lib/ecmascript.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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