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
moment.duration({minutes: 17, seconds: 25, milliseconds: 900}).asMilliseconds(); 1045900 //v2.60 1045899.9999999999 //v2.8.1
The text was updated successfully, but these errors were encountered:
You're right. The regression is in 2.7.0 to 2.8.1. We reimplemented duration, and evidently this thing slipped :)
Sorry, something went wrong.
The breaking change came in version 2.8.0, and it affects the .as() and .asUnits() methods for the units 'milliseconds', 'seconds', and 'minutes'.
The updated .as() implementation leads to floating point errors for those units.
Simple tests, that should be true:
true
moment.duration(1, "milliseconds").as("milliseconds") === 1; moment.duration(3, "seconds").as("seconds") === 3; moment.duration(13, "minutes").as("minutes") === 13;
Closing in favor of #1883
Successfully merging a pull request may close this issue.
moment.duration({minutes: 17, seconds: 25, milliseconds: 900}).asMilliseconds();
1045900 //v2.60
1045899.9999999999 //v2.8.1
The text was updated successfully, but these errors were encountered: