]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Add tests for format('ZZ') 1278/head
authorIskren Chernev <iskren.chernev@gmail.com>
Wed, 27 Nov 2013 09:34:01 +0000 (01:34 -0800)
committerIskren Chernev <iskren.chernev@gmail.com>
Wed, 27 Nov 2013 09:34:01 +0000 (01:34 -0800)
test/moment/zones.js

index 3019b82bbfb27d7dc9610cef96f58c7ce60d0a6e..341c38231b11afbd77eae135699e05868dad7898 100644 (file)
@@ -477,5 +477,16 @@ exports.zones = {
         test.equal(m.zone(), 13 * 60);
         test.equal(m.hours(), 0);
         test.done();
+    },
+
+    "timezone format" : function (test) {
+        test.equal(moment().zone(-60).format('ZZ'), "+0100", "-60 -> +0100");
+        test.equal(moment().zone(-90).format('ZZ'), "+0130", "-90 -> +0130");
+        test.equal(moment().zone(-120).format('ZZ'), "+0200", "-120 -> +0200");
+
+        test.equal(moment().zone(+60).format('ZZ'), "-0100", "+60 -> -0100");
+        test.equal(moment().zone(+90).format('ZZ'), "-0130", "+90 -> -0130");
+        test.equal(moment().zone(+120).format('ZZ'), "-0200", "+120 -> -0200");
+        test.done();
     }
 };