These are the commonly accepted ways of doing it in Javascript.
However with Typescript is we do !isNaN(someDate)
, typescript complains that we are using a method that accepts numbers, and not dates.
Thoughts on how to go about handling this?
These are the commonly accepted ways of doing it in Javascript.
However with Typescript is we do !isNaN(someDate)
, typescript complains that we are using a method that accepts numbers, and not dates.
Thoughts on how to go about handling this?
a Date object is not an number, but you can use Date.getTime()
getTime() return a number value or NaN
if the Date is not valid