You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You should use moment's strict parsing for this kind of thing. Otherwise, the parser doesn't do much checking of the input. In this case, you end up with a valid date anyways, I assume, because the returned date (January 1st, 13) is the same as the input date. Beyond that, I don't think strict mode checks to see if all the format tokens have been consumed, just that all the input has been.
Ah, my apologies. As I said, though, I think strict parsing only ensures that all the input has been consumed, which, in this case, it has. I'm not entirely certain this is a bug, per se, but unclear behavior for sure. Even my first thought was "Oh, strict parsing should fix this" when, clearly, it doesn't.
I notice if I do the following:
moment('013-01-01', 'YYYY-MM-DD').isValid()
it returns true but I'd expect it to return false.
The text was updated successfully, but these errors were encountered: