DEV Community

Discussion on: Date-ing Javascript

Collapse
 
lvegerano profile image
Luis Vegerano

Your Moment example is an example of what NOT to do with Moment. Moment only reliably parses ISO 8601 formats. Any other format behaves inconsistent and therefore should be given the format being use during the parsing. That is outlined in their docs momentjs.com/docs/#/parsing/string.

moment('2018-3-14', 'YYYY-M-DD') produces a valid date.

Collapse
 
squgeim profile image
Shreya Dahal

True. I just wanted to point out that you need to know what you are doing (while using moment or native dates) and just using moment blindly does not solve everything.