]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Don't call .utc() if makeMoment() returns null 1123/head
authorAdam Biggs <adam.biggs@lightmaker.com>
Fri, 20 Sep 2013 21:26:50 +0000 (14:26 -0700)
committerAdam Biggs <adam.biggs@lightmaker.com>
Fri, 20 Sep 2013 21:26:50 +0000 (14:26 -0700)
moment.js

index 1c680f49833a7ef94d773b210b9e70243057bc39..3f84fcc30de83f7a49b01447c890cd6e3dbccdd9 100644 (file)
--- a/moment.js
+++ b/moment.js
 
     // creating with utc
     moment.utc = function (input, format, lang, strict) {
+        var m;
+
         if (typeof(lang) === "boolean") {
             strict = lang;
             lang = undefined;
         }
-        return makeMoment({
+        m = makeMoment({
             _useUTC : true,
             _isUTC : true,
             _l : lang,
             _i : input,
             _f : format,
             _strict : strict
-        }).utc();
+        });
+        if (m != null) {
+            m = m.utc();
+        }
+
+        return m;
     };
 
     // creating with unix timestamp (in seconds)