]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Tweak float-rounding comment
authorIskren Chernev <me@iskren.info>
Sat, 23 Dec 2023 18:44:49 +0000 (20:44 +0200)
committerIskren Chernev <me@iskren.info>
Sat, 23 Dec 2023 18:44:49 +0000 (20:44 +0200)
src/lib/duration/constructor.js

index ee8a94f5b733771a5202da68189aaf6c004b1369..a315cd1fe4073e0c0ef1e83a5d775db1a26755d3 100644 (file)
@@ -20,9 +20,10 @@ export function Duration(duration) {
     // representation for dateAddRemove
     this._milliseconds =
         +milliseconds +
-        multiply(seconds, 1e3) + // 1000
-        multiply(minutes, 6e4) + // 1000 * 60
-        multiply(hours, 36e5); //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
+        // reduce floating point rounding errors
+        multiply(seconds, 1e3) +
+        multiply(minutes, 6e4) +
+        multiply(hours, 36e5);
     // Because of dateAddRemove treats 24 hours as different from a
     // day when working around DST, we need to store them separately
     this._days = +days + weeks * 7;