]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Implement https://github.com/moment/moment/pull/1871#issuecomment-53700377
authorIskren Chernev <iskren.chernev@gmail.com>
Fri, 5 Sep 2014 06:41:41 +0000 (23:41 -0700)
committerIskren Chernev <iskren.chernev@gmail.com>
Fri, 5 Sep 2014 06:41:41 +0000 (23:41 -0700)
moment.js

index bf2dab47e9d8c21ba3a588ab6010e8a7d4de5dce..22d68b61ab013395a2ab907947e6bf7747d8c7c2 100644 (file)
--- a/moment.js
+++ b/moment.js
                 this._isUTC = false;
 
                 if (keepLocalTime) {
-                    this.add(Math.round(this._d.getTimezoneOffset()), 'm');
+                    this.add(this._dateTzOffset(), 'm');
                 }
             }
             return this;
                     input = input * 60;
                 }
                 if (!this._isUTC && keepLocalTime) {
-                    localAdjust = Math.round(this._d.getTimezoneOffset());
+                    localAdjust = this._dateTzOffset();
                 }
                 this._offset = input;
                 this._isUTC = true;
                     }
                 }
             } else {
-                return this._isUTC ? offset : Math.round(this._d.getTimezoneOffset());
+                return this._isUTC ? offset : this._dateTzOffset();
             }
             return this;
         },
 
         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;
         }
     });