Skip to content

Commit

Permalink
Build 2.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
marwahaha committed Dec 11, 2017
1 parent cfe6e92 commit fea48bb
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 18 deletions.
12 changes: 7 additions & 5 deletions min/moment-with-locales.js
Expand Up @@ -2023,7 +2023,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]
function configFromArray (config) {
var i, date, input = [], currentDate, yearToUse;
var i, date, input = [], currentDate, expectedWeekday, yearToUse;

if (config._d) {
return;
Expand Down Expand Up @@ -2073,6 +2073,8 @@ 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) {
Expand All @@ -2084,7 +2086,7 @@ 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;
}
}
Expand Down Expand Up @@ -3660,7 +3662,7 @@ addRegexToken('Do', function (isStrict, locale) {

addParseToken(['D', 'DD'], DATE);
addParseToken('Do', function (input, array) {
array[DATE] = toInt(input.match(match1to2)[0], 10);
array[DATE] = toInt(input.match(match1to2)[0]);
});

// MOMENTS
Expand Down Expand Up @@ -4472,12 +4474,12 @@ addParseToken('x', function (input, array, config) {
// Side effect imports

//! moment.js
//! version : 2.19.3
//! version : 2.19.4
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com

hooks.version = '2.19.3';
hooks.version = '2.19.4';

setHookCallback(createLocal);

Expand Down
2 changes: 1 addition & 1 deletion min/moment-with-locales.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion min/moment.min.js

Large diffs are not rendered by default.

35 changes: 29 additions & 6 deletions min/tests.js
Expand Up @@ -58627,6 +58627,30 @@ test('parsing iso week year/week/weekday', function (assert) {
assert.equal(moment.utc('2012-W01').format(), '2012-01-02T00:00:00Z', '2012 week 1 (1st Jan Sun)');
});

test('parsing weekdays verifies the day', function (assert) {
// string with format
assert.ok(!moment('Wed 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is incorrect for the date');
assert.ok(moment('Thu 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is correct for the date');
});

test('parsing weekday on utc dates verifies day acccording to utc time', function (assert) {
assert.ok(moment.utc('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59');
});

test('parsing weekday on local dates verifies day acccording to local time', function (assert) {
// this doesn't do much useful if you're not in the US or at least close to it
assert.ok(moment('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59');
});

test('parsing weekday on utc dates with specified offsets verifies day acccording to that offset', function (assert) {
assert.ok(moment.utc('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59');
});

test('parsing weekday on local dates with specified offsets verifies day acccording to that offset', function (assert) {
// if you're in the US, these times will all be sometime Sunday, but they shoud parse as Monday
assert.ok(moment('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59');
});

test('parsing week year/week/weekday (dow 1, doy 4)', function (assert) {
moment.locale('dow:1,doy:4', {week: {dow: 1, doy: 4}});

Expand Down Expand Up @@ -59101,12 +59125,6 @@ test('k, kk', function (assert) {
}
});

test('mismatching day-of-week and date', function (assert) {
// string with format
assert.ok(!moment('Wed 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is incorrect for the date');
assert.ok(moment('Thu 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is correct for the date');
});

})));


Expand Down Expand Up @@ -72413,4 +72431,9 @@ test('parse zone with a minutes unit abs less than 16 should retain minutes', fu
assert.equal(o.hour(), 0);
});

test('parse zone with weekday on verifies day acccording to the offset', function (assert) {
test.expectedDeprecations();
assert.ok(moment.parseZone('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59');
});

})));
12 changes: 7 additions & 5 deletions moment.js
@@ -1,5 +1,5 @@
//! moment.js
//! version : 2.19.3
//! version : 2.19.4
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
Expand Down Expand Up @@ -2029,7 +2029,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]
function configFromArray (config) {
var i, date, input = [], currentDate, yearToUse;
var i, date, input = [], currentDate, expectedWeekday, yearToUse;

if (config._d) {
return;
Expand Down Expand Up @@ -2079,6 +2079,8 @@ 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) {
Expand All @@ -2090,7 +2092,7 @@ 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;
}
}
Expand Down Expand Up @@ -3666,7 +3668,7 @@ addRegexToken('Do', function (isStrict, locale) {

addParseToken(['D', 'DD'], DATE);
addParseToken('Do', function (input, array) {
array[DATE] = toInt(input.match(match1to2)[0], 10);
array[DATE] = toInt(input.match(match1to2)[0]);
});

// MOMENTS
Expand Down Expand Up @@ -4478,7 +4480,7 @@ addParseToken('x', function (input, array, config) {
// Side effect imports


hooks.version = '2.19.3';
hooks.version = '2.19.4';

setHookCallback(createLocal);

Expand Down

0 comments on commit fea48bb

Please sign in to comment.