I have a function that takes an array of type any[]
and compares the ExpiryDate
property with the current date and time. If the ExpiryDate
property is bigger then the current date and time, then it's a valid passport in this case, otherwise the passport has expired
currentPassports: any[];
oldPassports: any[];
passports: any[];
processPassports(passports: any[]): void {
var arrayLength = passports.length;
for (var i = 0; i < arrayLength; i++) {
if (passports[i].ExpiryDate > CurrentDateTime)
// Add the object to currentPassports
else
// Add the object to expiredPassports
}
}
What is the best way to compare SQL datetime to the current time in TypeScript? And how can I EXACTLY compare each object's ExpiryDate (also include Milliseconds in the comparison)
Note: CurrentDateTime
is just a placeholder