From 32134c589b69fe3f06347ec638945f38c1edbf4d Mon Sep 17 00:00:00 2001 From: Pavan Kumar VH Date: Thu, 3 Sep 2026 11:47:19 +0530 Subject: [PATCH] Use Number.isNaN instead of global isNaN in dates utility The global isNaN() function coerces non-numbers to numbers first, which can lead to unexpected results. Using Number.isNaN is more predictable and safer for type checking. --- common/src/util/dates.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/util/dates.ts b/common/src/util/dates.ts index 57096e324a..3ffe081e38 100644 --- a/common/src/util/dates.ts +++ b/common/src/util/dates.ts @@ -59,7 +59,7 @@ export const formatTimeUntil = ( const target = typeof date === 'string' ? new Date(date) : date const diffMs = target.getTime() - Date.now() - if (isNaN(diffMs) || diffMs <= 0) return fallback + if (Number.isNaN(diffMs) || diffMs <= 0) return fallback const diffMins = Math.floor(diffMs / (1000 * 60)) const diffHours = Math.floor(diffMins / 60)