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
> var j = moment(NaN)
undefined
> j.fromNow()
"a few seconds ago"
> j.calendar()
"Invalid date"
Why is it a bug?
Inconsistency (calendar() correctly detects that this date is invalid but fromNow() blindly spit out results
Probability. In our case we parse an angular attribute like this: moment(Number(attrs.epoch)) and instead of saying "Invalid date" it says "a few seconds ago".
version : 2.8.3
The text was updated successfully, but these errors were encountered:
Counter-point: Calling isValid() correctly returns false, so that should be all that matters. You should expect to see incorrect data when using an invalid date, and it should be up to the developer to handle that.
I agree it "feels" wrong, though... Perhaps the fromNow() method could return "Invalid date" if isValid() is false?
What is the bug?
Why is it a bug?
calendar()
correctly detects that this date is invalid butfromNow()
blindly spit out resultsmoment(Number(attrs.epoch))
and instead of saying "Invalid date" it says "a few seconds ago".version : 2.8.3
The text was updated successfully, but these errors were encountered: