]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Deprecate zone function in favor of utcOffset
authorIskren Chernev <iskren.chernev@gmail.com>
Fri, 28 Nov 2014 06:24:54 +0000 (22:24 -0800)
committerIskren Chernev <iskren.chernev@gmail.com>
Wed, 24 Dec 2014 21:29:52 +0000 (13:29 -0800)
moment.js

index feee9535dc9162b61f38c8778ee902aec34f6cb4..c1eba2fa2b7f2fc3f4d5c891fec61e9d93e71ea0 100644 (file)
--- a/moment.js
+++ b/moment.js
                 }
         ),
 
-        // 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)]-->