Yet another way to check whether the date is a valid date object:
const isValidDate = (date) =>
typeof date === 'object' &&
typeof date.getTime === 'function' &&
!isNaN(date.getTime())
Yet another way to check whether the date is a valid date object:
const isValidDate = (date) =>
typeof date === 'object' &&
typeof date.getTime === 'function' &&
!isNaN(date.getTime())