]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Add test for parseZone TZ inference case 1347/head
authorpimterry <pimterry@gmail.com>
Sun, 15 Dec 2013 17:50:56 +0000 (17:50 +0000)
committerpimterry <pimterry@gmail.com>
Sun, 15 Dec 2013 17:50:56 +0000 (17:50 +0000)
test/moment/zones.js

index eb638db1d51aecd4c79ba7908e877537341fa258..a497f9d6d3fb44d40f7819617d92d18eacdd1148 100644 (file)
@@ -482,7 +482,7 @@ exports.zones = {
         test.done();
     },
     
-    "parse zone dependent on format string" : function (test) {
+    "parse zone with a timezone from the format string" : function (test) {
         test.expect(1);
         
         var m = moment("11-12-2013 -0400 +1100", "DD-MM-YYYY ZZ #####").parseZone();
@@ -491,6 +491,15 @@ exports.zones = {
         test.done();
     },
 
+    "parse zone without a timezone included in the format string" : function (test) {
+        test.expect(1);
+
+        var m = moment("11-12-2013 -0400 +1100", "DD-MM-YYYY").parseZone();
+
+        test.equal(m.zone(), -11 * 60);
+        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");