DEV Community

Discussion on: Careful with dates in Javascript

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

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.