DEV Community

loading...

Discussion on: Careful with dates in Javascript

Collapse
patarapolw profile image
Pacharapol Withayasakpunt

I normally had to prevent parsing of numeric strings with /^-?\d+(?:\.\d+)?$/.

Also, don't trust user input strings or locale strings. Use ISO formats, or explicitly specify the format.