From: Iskren Chernev Date: Fri, 28 Nov 2014 06:24:54 +0000 (-0800) Subject: Deprecate zone function in favor of utcOffset X-Git-Tag: 2.9.0~23^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a1e0d1e4b0d8d2c099ae7d2f12d61f11498fba4;p=thirdparty%2Fmoment.git Deprecate zone function in favor of utcOffset --- diff --git a/moment.js b/moment.js index feee9535d..c1eba2fa2 100644 --- a/moment.js +++ b/moment.js @@ -2407,20 +2407,23 @@ } ), - // TODO: Deprecate - zone : function (input, keepLocalTime) { - if (input != null) { - if (typeof input !== 'string') { - input = -input; + zone : deprecate( + 'moment().zone is deprecated, use moment().utcOffset instead. ' + + 'https://github.com/moment/moment/issues/1779', + function (input, keepLocalTime) { + if (input != null) { + if (typeof input !== 'string') { + input = -input; + } + + this.utcOffset(input, keepLocalTime); + + return this; + } else { + return -this.utcOffset(); + } } - - this.utcOffset(input, keepLocalTime); - - return this; - } else { - return -this.utcOffset(); - } - }, + ), // keepLocalTime = true means only change the timezone, without // affecting the local hour. So 5:31:26 +0300 --[zone(2, true)]-->