From: Iskren Chernev Date: Thu, 6 Feb 2014 18:48:02 +0000 (-0800) Subject: zone setter can now skip adjusting the hour X-Git-Tag: 2.6.0~34^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de6b2362251f6de2a8a9f1acf8a73772b965384f;p=thirdparty%2Fmoment.git zone setter can now skip adjusting the hour When you change the zone you'd expect the time to remain the same, but if you're doing something low-level you might want just the zone offset to change. Add a second argument to zone that would allow the caller to disable adjusting the hour when setting a zone. --- diff --git a/moment.js b/moment.js index edf54c173..2f368f3d8 100644 --- a/moment.js +++ b/moment.js @@ -2038,7 +2038,8 @@ return other > this ? this : other; }, - zone : function (input) { + zone : function (input, adjust) { + adjust = (adjust == null ? true : false); var offset = this._offset || 0; if (input != null) { if (typeof input === "string") { @@ -2049,7 +2050,7 @@ } this._offset = input; this._isUTC = true; - if (offset !== input) { + if (offset !== input && adjust) { addOrSubtractDurationFromMoment(this, moment.duration(offset - input, 'm'), 1, true); } } else {