When inputing string with number the new Date() is missbehaving, is there another way how to achieve this without regex?
let string = 'some string 1';
let invalid = new Date(string);
it is still parsing as a Date value
Mon Jan 01 2001 00:00:00 GMT+0000 (Greenwich Mean Time)
I’m expecting it as an invalid date
2
Answers
Update
Seem to resolve to Invalid Date as i want to and it seem to proper validate all dates also human readable dates like Sun, 1 Dec 2024
Now the function will return the date is valid or not.