From: Tim Wood Date: Fri, 26 Oct 2012 19:15:12 +0000 (-1100) Subject: Always set _useUTC to true when parsing using moment.utc() X-Git-Tag: 2.0.0~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd3ae6ada4e797274d7ae6d50b9dcb446eb4858c;p=thirdparty%2Fmoment.git Always set _useUTC to true when parsing using moment.utc() --- diff --git a/moment.js b/moment.js index 69b964c09..0c77e8921 100644 --- a/moment.js +++ b/moment.js @@ -851,15 +851,15 @@ ************************************/ - moment = function (input, format) { + moment = function (input, format, altConfigs) { if (input === null || input === '') { return null; } - var config = { + var config = extend({ _i : typeof input === 'string' ? getLangDefinition().preparse(input) : input, _f : format, _isUTC : false - }; + }, altConfigs || {}); if (moment.isMoment(input)) { config = extend({}, input); @@ -891,15 +891,10 @@ return new Moment(config); } - // if we don't have a timezone, we need to add one to trigger parsing into utc - if (typeof input === 'string' && !parseTokenTimezone.exec(input)) { - input += ' +0000'; - if (format) { - format += ' Z'; - } - } - return moment(input, format).utc(); + return moment(input, format, { + _useUTC : true + }).utc(); }; // creating with unix timestamp (in seconds)