From: Adam Biggs Date: Fri, 20 Sep 2013 21:26:50 +0000 (-0700) Subject: Don't call .utc() if makeMoment() returns null X-Git-Tag: 2.3.0~22^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1123%2Fhead;p=thirdparty%2Fmoment.git Don't call .utc() if makeMoment() returns null --- diff --git a/moment.js b/moment.js index 1c680f498..3f84fcc30 100644 --- a/moment.js +++ b/moment.js @@ -1270,18 +1270,25 @@ // 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)