]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Fix moment.utc with array of formats 1895/head
authorIskren Chernev <iskren.chernev@gmail.com>
Fri, 29 Aug 2014 15:44:41 +0000 (18:44 +0300)
committerIskren Chernev <iskren.chernev@gmail.com>
Fri, 5 Sep 2014 04:47:44 +0000 (21:47 -0700)
Fixes #1878

moment.js
test/moment/create.js

index 3b5d65adc3185d0104ffe0b6e4d0ae3673d0f1d1..2941b917056a6d858d474e7baaeb5c6a61560650 100644 (file)
--- a/moment.js
+++ b/moment.js
         for (i = 0; i < config._f.length; i++) {
             currentScore = 0;
             tempConfig = copyConfig({}, config);
+            if (config._useUTC != null) {
+                tempConfig._useUTC = config._useUTC;
+            }
             tempConfig._pf = defaultParsingFlags();
             tempConfig._f = config._f[i];
             makeDateFromStringAndFormat(tempConfig);
index a141d669b9700d60079fbdf689973a67f54b6667..f8f7ac77b2938f2963814c5aaa2958d17aba3ab2 100644 (file)
@@ -943,6 +943,13 @@ exports.create = {
                 true,
                 'string array + isValid');
         test.done();
+    },
+
+    'utc with array of formats' : function (test) {
+        test.equal(moment.utc('2014-01-01', ['YYYY-MM-DD', 'YYYY-MM']).format(),
+                '2014-01-01T00:00:00+00:00',
+                'moment.utc works with array of formats');
+        test.done();
     }
 
 };