]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
force moment.utc() to use utc 1007/head
authorIsaac Cambron <icambron@gmail.com>
Mon, 19 Aug 2013 05:50:10 +0000 (01:50 -0400)
committerIsaac Cambron <icambron@gmail.com>
Mon, 19 Aug 2013 05:50:10 +0000 (01:50 -0400)
moment.js
test/moment/utc.js

index fe9df98a1b1c122176ae123ec6834069b21cd57f..a2c582f3335cde3b201108fd26f89df0d181d58a 100644 (file)
--- a/moment.js
+++ b/moment.js
             _l : lang,
             _i : input,
             _f : format
-        });
+        }).utc();
     };
 
     // creating with unix timestamp (in seconds)
index 7fb1109c886c16cad98a9a821c628b4fa1b6c9df..89e94c0530d21749e5c0d5b4f6638df7ddcb6039 100644 (file)
@@ -72,6 +72,20 @@ exports.utc = {
         test.equal(m.date(), 1, "the day should be correct for utc parse with timezone");
         test.equal(m.hours(), 23, "the hours should be correct for utc parse with timezone");
 
+        test.done();
+    },
+
+    "cloning with utc" : function (test) {
+        test.expect(4);
+
+        var m = moment.utc("2012-01-02T08:20:00");
+        test.equal(moment.utc(m)._isUTC, true, "the local zone should be converted to UTC");
+        test.equal(moment.utc(m.clone().utc())._isUTC, true, "the local zone should stay in UTC");
+
+        m.zone(120);
+        test.equal(moment.utc(m)._isUTC, true, "the explicit zone should stay in UTC");
+        test.equal(moment.utc(m).zone(), 0, "the explicit zone should have an offset of 0");
+
         test.done();
     }
 };