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
The date parsing feature may not be strict enough:
moment("20120101") gives Invalid Date (probably it would understand it as unix time?)
moment("2012-01-01") parses the date correctly
moment("20120101", "YYYYMMDD") parses it correctly as well
However with a bogus date string I noticed an odd behaviour:
moment("a") correctly gives Invalid Date
moment("a", "YYYYMMDD") on the other hand results in: Sat Jan 01 0 00:00:00 GMT+0000 (GMT)
I really hoped the date parsing would do some validity checks for me (e.g. check against the length specified in the format and check for numbers vs. strings).
Is this the desired behaviour or a bug?
Also: moment("") and moment(null) both result in null being returned. For an empty string should that be null or Invalid Date?
The text was updated successfully, but these errors were encountered:
The date parsing feature may not be strict enough:
However with a bogus date string I noticed an odd behaviour:
I really hoped the date parsing would do some validity checks for me (e.g. check against the length specified in the format and check for numbers vs. strings).
Is this the desired behaviour or a bug?
Also: moment("") and moment(null) both result in null being returned. For an empty string should that be null or Invalid Date?
The text was updated successfully, but these errors were encountered: