]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Use Math.round instead of Math.floor for more realistic days output.
authorJohn Madhavan-Reese <jsmreese@pureshare.com>
Fri, 12 Sep 2014 21:16:07 +0000 (17:16 -0400)
committerIskren Chernev <iskren.chernev@gmail.com>
Mon, 17 Nov 2014 07:31:04 +0000 (23:31 -0800)
moment.js

index 595a01e1c34e687c3d795bb3367d08ca310eb656..798842b490504eeb3433b95a480708bc649ec783 100644 (file)
--- a/moment.js
+++ b/moment.js
                 return units === 'month' ? months : months / 12;
             } else {
                 // handle milliseconds separately because of floating point math errors (issue #1867)
-                days = this._days + Math.floor(yearsToDays(this._months / 12));
+                days = this._days + Math.round(yearsToDays(this._months / 12));
                 switch (units) {
                     case 'week': return days / 7 + this._milliseconds / 6048e5;
                     case 'day': return days + this._milliseconds / 864e5;