fix error Invalid time value
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m16s

This commit is contained in:
Warunee Tamkoo 2026-02-13 17:03:43 +07:00
parent 0a3deb4293
commit 1a9947d362

View file

@ -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;