I'm having trouble validating the following string which comes from the new Date()
Object.
"2020-10-06T14:23:43.964Z"
. In my case, I'll be expecting either this input format or a new Date()
. I'm trying to write something to do this similar to
const isValidDate = (d: Date):boolean => {
if (d instanceof Date || /* check if valid Date string here */) {
return true
}
return false
}