fix error Invalid time value
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m16s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m16s
This commit is contained in:
parent
0a3deb4293
commit
1a9947d362
1 changed files with 3 additions and 0 deletions
|
|
@ -300,6 +300,9 @@ class Extension {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CalculateAge(appointDate: Date, plusYear: number = 0, subtractYear: number = 0) {
|
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 currentDate = new Date().getTime();
|
||||||
let appointDateTime = new Date(appointDate).getTime();
|
let appointDateTime = new Date(appointDate).getTime();
|
||||||
let ageInMilliseconds = currentDate - appointDateTime;
|
let ageInMilliseconds = currentDate - appointDateTime;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue