From 7d6d9d2559a0b0a4bfc4d5b78f1dceed76150840 Mon Sep 17 00:00:00 2001 From: Pavan Kumar VH Date: Thu, 3 Sep 2026 11:33:53 +0530 Subject: [PATCH] Use Number.isNaN instead of global isNaN for type safety The global isNaN() function coerces non-numbers to numbers first, which can lead to unexpected results. For example, isNaN('hello') returns true because 'hello' is coerced to NaN, but Number.isNaN('hello') returns false because 'hello' is not a number type. Using Number.isNaN is more predictable and safer for type checking. --- common/src/util/log-ingest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/util/log-ingest.ts b/common/src/util/log-ingest.ts index ea108bd0fa..88cc9e6c6a 100644 --- a/common/src/util/log-ingest.ts +++ b/common/src/util/log-ingest.ts @@ -72,7 +72,7 @@ export function buildLogRows(params: { } return { id: crypto.randomUUID(), - timestamp: isNaN(ts.getTime()) ? now : ts, + timestamp: Number.isNaN(ts.getTime()) ? now : ts, level: record.level, source, service,