From: John Madhavan-Reese Date: Fri, 12 Sep 2014 21:16:07 +0000 (-0400) Subject: Use Math.round instead of Math.floor for more realistic days output. X-Git-Tag: 2.8.4~9^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6b6e012b832ade6f1314284473c1c68ab049d62;p=thirdparty%2Fmoment.git Use Math.round instead of Math.floor for more realistic days output. --- diff --git a/moment.js b/moment.js index 595a01e1c..798842b49 100644 --- a/moment.js +++ b/moment.js @@ -2776,7 +2776,7 @@ 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;