17

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?

Ole
  • 41,793
  • 59
  • 191
  • 359

1 Answers1

22

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