]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors
authorAfanasii Kurakin <afanasy@users.noreply.github.com>
Tue, 1 Mar 2016 05:13:43 +0000 (13:13 +0800)
committerIskren Chernev <iskren.chernev@gmail.com>
Sat, 16 Apr 2016 07:39:50 +0000 (00:39 -0700)
src/lib/duration/constructor.js

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