function checkWeekday(weekdayStr, parsedInput, config) {
if (weekdayStr) {
- // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
+ // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
if (weekdayProvided !== weekdayActual) {
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) {
+test('parsing weekday on utc dates verifies day according 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) {
+test('parsing weekday on local dates verifies day according 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) {
+test('parsing weekday on utc dates with specified offsets verifies day according 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
+test('parsing weekday on local dates with specified offsets verifies day according to that offset', function (assert) {
+ // if you're in the US, these times will all be sometime Sunday, but they should parse as Monday
assert.ok(moment('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59');
});
assert.equal(moment.duration('26:45').milliseconds(), 0, '0 milliseconds');
});
-test('instatiation from serialized C# TimeSpan zero', function (assert) {
+test('instantiation from serialized C# TimeSpan zero', function (assert) {
assert.equal(moment.duration('00:00:00').years(), 0, '0 years');
assert.equal(moment.duration('00:00:00').days(), 0, '0 days');
assert.equal(moment.duration('00:00:00').hours(), 0, '0 hours');
assert.equal(moment.duration('00:00:00').milliseconds(), 0, '0 milliseconds');
});
-test('instatiation from serialized C# TimeSpan with days', function (assert) {
+test('instantiation from serialized C# TimeSpan with days', function (assert) {
assert.equal(moment.duration('1.02:03:04.9999999').years(), 0, '0 years');
assert.equal(moment.duration('1.02:03:04.9999999').days(), 1, '1 day');
assert.equal(moment.duration('1.02:03:04.9999999').hours(), 2, '2 hours');
assert.equal(moment.duration('1 02:03:04.9999999').milliseconds(), 0, '0 milliseconds');
});
-test('instatiation from serialized C# TimeSpan without days', function (assert) {
+test('instantiation from serialized C# TimeSpan without days', function (assert) {
assert.equal(moment.duration('01:02:03.9999999').years(), 0, '0 years');
assert.equal(moment.duration('01:02:03.9999999').days(), 0, '0 days');
assert.equal(moment.duration('01:02:03.9999999').hours(), 1, '1 hour');
assert.equal(moment.duration('500:59:59.8888888').hours(), 20, '500 hours overflows to 20 hours');
});
-test('instatiation from serialized C# TimeSpan without days or milliseconds', function (assert) {
+test('instantiation from serialized C# TimeSpan without days or milliseconds', function (assert) {
assert.equal(moment.duration('01:02:03').years(), 0, '0 years');
assert.equal(moment.duration('01:02:03').days(), 0, '0 days');
assert.equal(moment.duration('01:02:03').hours(), 1, '1 hour');
assert.equal(moment.duration('01:02:03').milliseconds(), 0, '0 milliseconds');
});
-test('instatiation from serialized C# TimeSpan without milliseconds', function (assert) {
+test('instantiation from serialized C# TimeSpan without milliseconds', function (assert) {
assert.equal(moment.duration('1.02:03:04').years(), 0, '0 years');
assert.equal(moment.duration('1.02:03:04').days(), 1, '1 day');
assert.equal(moment.duration('1.02:03:04').hours(), 2, '2 hours');
assert.equal(moment.duration('+00:00:15.7205000').milliseconds(), 721, '721 milliseconds');
});
-test('instatiation from serialized C# TimeSpan maxValue', function (assert) {
+test('instantiation from serialized C# TimeSpan maxValue', function (assert) {
var d = moment.duration('10675199.02:48:05.4775807');
assert.equal(d.years(), 29227, '29227 years');
assert.equal(d.milliseconds(), 478, '478 milliseconds');
});
-test('instatiation from serialized C# TimeSpan minValue', function (assert) {
+test('instantiation from serialized C# TimeSpan minValue', function (assert) {
var d = moment.duration('-10675199.02:48:05.4775808');
assert.equal(d.years(), -29227, '29653 years');
assert.equal(d.milliseconds(), -478, '478 milliseconds');
});
-test('instatiation from serialized C# TimeSpan maxValue with + sign', function (assert) {
+test('instantiation from serialized C# TimeSpan maxValue with + sign', function (assert) {
var d = moment.duration('+10675199.02:48:05.4775808');
assert.equal(d.years(), 29227, '29653 years');
assert.equal(m.isAfter(moment(new Date(2011, 3, 3, 3, 4, 9, 10)), 'minute'), false, 'day is later');
assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 3, 4, 9, 10)), 'minute'), true, 'day is earlier');
assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 4, 4, 9, 10)), 'minute'), false, 'hour is later');
- assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), true, 'hour is earler');
+ assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), true, 'hour is earlier');
assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 5, 9, 10)), 'minute'), false, 'minute is later');
assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 3, 9, 10)), 'minute'), true, 'minute is earlier');
assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 0, 0)), 'minute'), false, 'exact start of minute');
assert.equal(m.isBefore(moment(new Date(2011, 3, 3, 3, 4, 9, 10)), 'minute'), true, 'day is later');
assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 3, 4, 9, 10)), 'minute'), false, 'day is earlier');
assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 4, 4, 9, 10)), 'minute'), true, 'hour is later');
- assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), false, 'hour is earler');
+ assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), false, 'hour is earlier');
assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 5, 9, 10)), 'minute'), true, 'minute is later');
assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 3, 9, 10)), 'minute'), false, 'minute is earlier');
assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 0, 0)), 'minute'), false, 'exact start of minute');
});
moment.defineLocale('child-months', {
parentLocale: 'base-months',
- months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelveth '.split('_')
+ months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelfth '.split('_')
});
assert.ok(moment.utc('2015-01-01', 'YYYY-MM-DD').format('MMMM'), 'First', 'months uses child');
});
moment.defineLocale('months-x', {
parentLocale: 'base-months-x',
- months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelveth '.split('_')
+ months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelfth '.split('_')
});
assert.equal(moment.locale(), 'en', 'failed to set a locale requiring missing parent');
});
moment.updateLocale('months', {
parentLocale: 'base-months',
- months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelveth '.split('_')
+ months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelfth '.split('_')
});
assert.ok(moment.utc('2015-01-01', 'YYYY-MM-DD').format('MMMM'), 'First', 'months uses child');
});
assert.equal(moment([2029, 8, 19]).weekday(), 1, 'Sep 19 2029 is Wednesday -- 1st day');
assert.equal(moment([2013, 3, 25]).weekday(), 2, 'Apr 25 2013 is Thursday -- 2nd day');
assert.equal(moment([2015, 2, 6]).weekday(), 3, 'Mar 6 2015 is Friday -- 3nd day');
- assert.equal(moment([1970, 0, 3]).weekday(), 4, 'Jan 3 1970 is Staturday -- 4th day');
+ assert.equal(moment([1970, 0, 3]).weekday(), 4, 'Jan 3 1970 is Saturday -- 4th day');
assert.equal(moment([2001, 4, 13]).weekday(), 5, 'May 13 2001 is Sunday -- 5th day');
assert.equal(moment([2000, 0, 3]).weekday(), 6, 'Jan 3 2000 is Monday -- 6th day');
});
test('weekday first day of week Friday (dow 5)', function (assert) {
moment.locale('dow: 5,doy: 6', {week: {dow: 5, doy: 6}});
assert.equal(moment([1985, 1, 8]).weekday(), 0, 'Feb 8 1985 is Friday -- 0th day');
- assert.equal(moment([2029, 8, 22]).weekday(), 1, 'Sep 22 2029 is Staturday -- 1st day');
+ assert.equal(moment([2029, 8, 22]).weekday(), 1, 'Sep 22 2029 is Saturday -- 1st day');
assert.equal(moment([2013, 3, 28]).weekday(), 2, 'Apr 28 2013 is Sunday -- 2nd day');
assert.equal(moment([2015, 2, 9]).weekday(), 3, 'Mar 9 2015 is Monday -- 3nd day');
assert.equal(moment([1970, 0, 6]).weekday(), 4, 'Jan 6 1970 is Tuesday -- 4th day');
test('weekday first day of week Saturday (dow 6)', function (assert) {
moment.locale('dow: 6,doy: 6', {week: {dow: 6, doy: 6}});
- assert.equal(moment([1985, 1, 9]).weekday(), 0, 'Feb 9 1985 is Staturday -- 0th day');
+ assert.equal(moment([1985, 1, 9]).weekday(), 0, 'Feb 9 1985 is Saturday -- 0th day');
assert.equal(moment([2029, 8, 23]).weekday(), 1, 'Sep 23 2029 is Sunday -- 1st day');
assert.equal(moment([2013, 3, 29]).weekday(), 2, 'Apr 29 2013 is Monday -- 2nd day');
assert.equal(moment([2015, 2, 10]).weekday(), 3, 'Mar 10 2015 is Tuesday -- 3nd day');
assert.equal(o.hour(), 0);
});
-test('parse zone with weekday on verifies day acccording to the offset', function (assert) {
+test('parse zone with weekday on verifies day according 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');
});