From 7e12b68dbb44fbda1353176dd63229722c8f1f6b Mon Sep 17 00:00:00 2001 From: Pavan Kumar VH Date: Thu, 3 Sep 2026 17:15:56 +0530 Subject: [PATCH] Fix Infinity validation in addDaysToDateKey The function only checked for NaN, not Infinity. If the date string represented an extreme date, getTime() could return Infinity, causing the date arithmetic to produce invalid results. Changed Number.isNaN() to Number.isFinite() to catch both NaN and Infinity. --- common/src/util/freebuff-streak.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/util/freebuff-streak.ts b/common/src/util/freebuff-streak.ts index f61f22832a..4b70bc2e97 100644 --- a/common/src/util/freebuff-streak.ts +++ b/common/src/util/freebuff-streak.ts @@ -48,7 +48,7 @@ export function getFreebuffUsageDateKey( export function addDaysToDateKey(dateKey: string, days: number): string { const date = new Date(`${dateKey}T00:00:00.000Z`) - if (Number.isNaN(date.getTime())) { + if (!Number.isFinite(date.getTime())) { throw new Error(`Invalid date key: ${dateKey}`) }