diff options
Diffstat (limited to 'node_modules/moment/src/lib/create')
-rw-r--r-- | node_modules/moment/src/lib/create/from-array.js | 6 | ||||
-rw-r--r-- | node_modules/moment/src/lib/create/from-string.js | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/node_modules/moment/src/lib/create/from-array.js b/node_modules/moment/src/lib/create/from-array.js index 7626c455d..b5a0911de 100644 --- a/node_modules/moment/src/lib/create/from-array.js +++ b/node_modules/moment/src/lib/create/from-array.js @@ -21,7 +21,7 @@ function currentDateArray(config) { // note: all values past the year are optional and will default to the lowest possible value. // [year, month, day , hour, minute, second, millisecond] export function configFromArray (config) { - var i, date, input = [], currentDate, yearToUse; + var i, date, input = [], currentDate, expectedWeekday, yearToUse; if (config._d) { return; @@ -71,6 +71,8 @@ export function configFromArray (config) { } config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); + expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); + // Apply timezone offset from input. The actual utcOffset can be changed // with parseZone. if (config._tzm != null) { @@ -82,7 +84,7 @@ export function configFromArray (config) { } // check for mismatching day of week - if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) { + if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) { getParsingFlags(config).weekdayMismatch = true; } } diff --git a/node_modules/moment/src/lib/create/from-string.js b/node_modules/moment/src/lib/create/from-string.js index 7c1052a3e..c5ad56bab 100644 --- a/node_modules/moment/src/lib/create/from-string.js +++ b/node_modules/moment/src/lib/create/from-string.js @@ -128,7 +128,7 @@ function untruncateYear(yearStr) { function preprocessRFC2822(s) { // Remove comments and folding whitespace and replace multiple-spaces with a single space - return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim(); + return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, ''); } function checkWeekday(weekdayStr, parsedInput, config) { |