I have this function:
isAuthenticationExpired = (expirationDate: Date) => {
var now = new Date();
if (expirationDate - now > 0) {
return false;
} else {
return true;
}
}
Both expirationDate
and now
are of type Date
Typescript give me an error saying:
Error 3 The left-hand side of an arithmetic operation must be of type
'any', 'number' or an enum type.
Error 4 The right-hand side of an arithmetic operation must be of type
'any', 'number' or an enum type.
How can I check if the date has expired as my way does not seem to work?