From: Iskren Chernev Date: Fri, 5 Sep 2014 06:41:41 +0000 (-0700) Subject: Implement https://github.com/moment/moment/pull/1871#issuecomment-53700377 X-Git-Tag: 2.8.3~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a970ee6b9e14d7d659e3ad851a8f09037f593647;p=thirdparty%2Fmoment.git Implement https://github.com/moment/moment/pull/1871#issuecomment-53700377 --- diff --git a/moment.js b/moment.js index bf2dab47e..22d68b61a 100644 --- a/moment.js +++ b/moment.js @@ -2136,7 +2136,7 @@ this._isUTC = false; if (keepLocalTime) { - this.add(Math.round(this._d.getTimezoneOffset()), 'm'); + this.add(this._dateTzOffset(), 'm'); } } return this; @@ -2345,7 +2345,7 @@ input = input * 60; } if (!this._isUTC && keepLocalTime) { - localAdjust = Math.round(this._d.getTimezoneOffset()); + localAdjust = this._dateTzOffset(); } this._offset = input; this._isUTC = true; @@ -2363,7 +2363,7 @@ } } } else { - return this._isUTC ? offset : Math.round(this._d.getTimezoneOffset()); + return this._isUTC ? offset : this._dateTzOffset(); } return this; }, @@ -2493,6 +2493,12 @@ localeData : function () { return this._locale; + }, + + _dateTzOffset : function () { + // On Firefox.24 Date#getTimezoneOffset returns a floating point. + // https://github.com/moment/moment/pull/1871 + return Math.round(this._d.getTimezoneOffset() / 15) * 15; } });