Hacker News new | ask | show | jobs
Parsing Date in JavaScript (simplified.me)
7 points by hypernurb 4110 days ago
1 comments

Moment.js has the unfortunate property that it will recognize many non-dates as dates, so it's not much good for validation. For example: `moment("cats 123 <3!!!").isValid()` returns `true`. I have yet to find a date parsing library that will correctly reject this input.
I always prefer handling all the Date related stuff on backend and avoid relying on JS as much as I can.
This is a good idea, unfortunately I've worked on projects recently in which the "backend" is in JS.