From 1a9947d36279c72391c3a8733295a4ddc39bb947 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Fri, 13 Feb 2026 17:03:43 +0700 Subject: [PATCH] fix error Invalid time value --- src/interfaces/extension.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/interfaces/extension.ts b/src/interfaces/extension.ts index 836c994d..ff6aeccb 100644 --- a/src/interfaces/extension.ts +++ b/src/interfaces/extension.ts @@ -300,6 +300,9 @@ class Extension { } public static CalculateAge(appointDate: Date, plusYear: number = 0, subtractYear: number = 0) { + if (appointDate == null || appointDate == undefined) return 0; + // Check for Invalid Date + if (isNaN(appointDate.getTime())) return 0; let currentDate = new Date().getTime(); let appointDateTime = new Date(appointDate).getTime(); let ageInMilliseconds = currentDate - appointDateTime;