Using moment does not solve this issue. Initializing date with a string that is not strictly ISO 8601 is inconsistent in the specification itself and depends on the browser.
On Safari:
> new Date('2018-3-14')
â‹– Invalid Date
> moment('2018-3-14')
â‹– Invalid Date
Using moment does not solve this issue. Initializing date with a string that is not strictly ISO 8601 is inconsistent in the specification itself and depends on the browser.
On Safari:
This works on Chrome, though. :D
More about the moment issue here: github.com/moment/moment/issues/1407
I have a more thorough write-up on this with a lot more caveats here: blog.lftechnology.com/date-ing-jav...
Thanks for the link. That is a great article on many of the JS Date caveats.