Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moment.fromNow() returns "Invalid date" even though .isValid() is true #4614

Closed
SamusAranX opened this issue May 7, 2018 · 3 comments
Closed

Comments

@SamusAranX
Copy link

SamusAranX commented May 7, 2018

Description of the Issue and Steps to Reproduce:

I'm using a custom version of MomentJS 2.20.1 where I removed all locales but the German one: https://gist.github.com/SamusAranX/4df8b46fa49b09af1a657cf877e51666

I tried updating to the most recent version (2.22.1), but it exhibits the exact same problem:
For some reason, .fromNow() just stopped working.

var m = moment("2018-05-07 11:40:30");
m.fromNow(); // returns "Invalid date"

var m2 = moment([2018, 5, 7]);
m2.fromNow(); // returns "Invalid date" as well

Curiously, .isValid() returns true with both dates.

Am I doing something wrong? Those dates look good to me.

Environment:

Safari 11.1 and Chrome 66 on macOS 10.13.4

Mon May 07 2018 11:50:47 GMT+0200 (CEST)
5/7/2018, 11:50:47 AM
-120
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15
2.20.1
@galinkyuchukov
Copy link

Have same problem in nodejs! In a browser - no issues!

@ichernev
Copy link
Contributor

I tried this on slightly updated safari and macos and I don't see the issue with moment 2.22.2. Can you please verify?

@marwahaha
Copy link
Member

closing as dupe of #4802, but worrisome that many people are reporting this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants