We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Description of the Issue and Steps to Reproduce: execute moment('2016-02-01').diff('2016-03-01', 'days')
moment('2016-02-01').diff('2016-03-01', 'days')
Environment: react 1.6
react 1.6
Examples: Chrome 49 on OSX, Internet Explorer 10 on Windows 7, Node.JS 4.4.4 on Ubuntu 16.0.4 chrome
Basically, I wanted to calculate days between these two dates and the result is -29.
-29
The text was updated successfully, but these errors were encountered:
This is achievable through another way.
moment.duration(moment('2016-02-01').diff(moment('2016-03-01'))).asDays()
Sorry, something went wrong.
@stackninigi Positive vs negative results from diff let you know which date is earlier / later than the other.
If you wanted a positive result, you should ensure you do later.diff(earlier, ...) i.e. moment('2016-03-01').diff('2016-02-01', 'days')
later.diff(earlier, ...)
moment('2016-03-01').diff('2016-02-01', 'days')
What @ashsearle said. I would take the Math.abs() of the result.
Math.abs()
No branches or pull requests
Description of the Issue and Steps to Reproduce:
execute
moment('2016-02-01').diff('2016-03-01', 'days')
Environment:
react 1.6
Examples: Chrome 49 on OSX, Internet Explorer 10 on Windows 7, Node.JS 4.4.4 on Ubuntu 16.0.4
chrome
Basically, I wanted to calculate days between these two dates and the result is
-29
.The text was updated successfully, but these errors were encountered: