I have the following strings:
a='Check 134', a='2020-01-15T10:47:54Z', a='1234', a= some object I want to check, whether the string is a date or not.
I tried:
new Date(a) instanceof Date && !isNaN(new Date(a).getTime()) , but it returns true for a='Check 123', whenever it has numbers.
What could be a better solution?
Note: I do not want to use momentjs, because of project restrictions
/\d+-\d+-\d+T\d+:\d+:\d+Z/.match(a)…?