When inputing string with number the new Date() is missbehaving, is there another way how to achieve this without regex?
<code>let string = 'some string 1';
let invalid = new Date(string);
</code>
<code>let string = 'some string 1';
let invalid = new Date(string);
</code>
let string = 'some string 1';
let invalid = new Date(string);
it is still parsing as a Date value
<code>Mon Jan 01 2001 00:00:00 GMT+0000 (Greenwich Mean Time)
</code>
<code>Mon Jan 01 2001 00:00:00 GMT+0000 (Greenwich Mean Time)
</code>
Mon Jan 01 2001 00:00:00 GMT+0000 (Greenwich Mean Time)
I’m expecting it as an invalid date
New contributor
Dzi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.