From: Mark Stosberg Date: Wed, 19 Oct 2016 13:42:23 +0000 (-0400) Subject: Fix invalid ISO format dates in the test suite. X-Git-Tag: 2.16.0~16^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e11791d2ea967493abb0b4bc07b81743e6d17c57;p=thirdparty%2Fmoment.git Fix invalid ISO format dates in the test suite. Fixing the strictness of ISO date parsing exposed this invalid ISO format dates which included a time zone offset without including a time. By appending a time of "00:00:00" to the date strings they became ISO-valid again without changing the meaning of the test. --- diff --git a/src/test/moment/is_same.js b/src/test/moment/is_same.js index 150194ee2..e0d92ba3b 100644 --- a/src/test/moment/is_same.js +++ b/src/test/moment/is_same.js @@ -140,9 +140,9 @@ test('is same millisecond', function (assert) { }); test('is same with utc offset moments', function (assert) { - assert.ok(moment.parseZone('2013-02-01T-05:00').isSame(moment('2013-02-01'), 'year'), 'zoned vs local moment'); + assert.ok(moment.parseZone('2013-02-01T00:00:00-05:00').isSame(moment('2013-02-01'), 'year'), 'zoned vs local moment'); assert.ok(moment('2013-02-01').isSame(moment('2013-02-01').utcOffset('-05:00'), 'year'), 'local vs zoned moment'); - assert.ok(moment.parseZone('2013-02-01T-05:00').isSame(moment.parseZone('2013-02-01T-06:30'), 'year'), + assert.ok(moment.parseZone('2013-02-01T00:00:00-05:00').isSame(moment.parseZone('2013-02-01T00:00:00-06:30'), 'year'), 'zoned vs (differently) zoned moment'); }); diff --git a/src/test/moment/is_same_or_after.js b/src/test/moment/is_same_or_after.js index 7e096139b..b1200b5ba 100644 --- a/src/test/moment/is_same_or_after.js +++ b/src/test/moment/is_same_or_after.js @@ -161,9 +161,9 @@ test('is same or after millisecond', function (assert) { }); test('is same or after with utc offset moments', function (assert) { - assert.ok(moment.parseZone('2013-02-01T-05:00').isSameOrAfter(moment('2013-02-01'), 'year'), 'zoned vs local moment'); + assert.ok(moment.parseZone('2013-02-01T00:00:00-05:00').isSameOrAfter(moment('2013-02-01'), 'year'), 'zoned vs local moment'); assert.ok(moment('2013-02-01').isSameOrAfter(moment('2013-02-01').utcOffset('-05:00'), 'year'), 'local vs zoned moment'); - assert.ok(moment.parseZone('2013-02-01T-05:00').isSameOrAfter(moment.parseZone('2013-02-01T-06:30'), 'year'), + assert.ok(moment.parseZone('2013-02-01T00:00:00-05:00').isSameOrAfter(moment.parseZone('2013-02-01T00:00:00-06:30'), 'year'), 'zoned vs (differently) zoned moment'); }); diff --git a/src/test/moment/is_same_or_before.js b/src/test/moment/is_same_or_before.js index 6a341ae45..b530f7c5f 100644 --- a/src/test/moment/is_same_or_before.js +++ b/src/test/moment/is_same_or_before.js @@ -161,10 +161,12 @@ test('is same or before millisecond', function (assert) { }); test('is same with utc offset moments', function (assert) { - assert.ok(moment.parseZone('2013-02-01T-05:00').isSameOrBefore(moment('2013-02-01'), 'year'), 'zoned vs local moment'); + assert.ok(moment.parseZone('2013-02-01T00:00:00-05:00').isSameOrBefore(moment('2013-02-01'), 'year'), 'zoned vs local moment'); assert.ok(moment('2013-02-01').isSameOrBefore(moment('2013-02-01').utcOffset('-05:00'), 'year'), 'local vs zoned moment'); - assert.ok(moment.parseZone('2013-02-01T-05:00').isSameOrBefore(moment.parseZone('2013-02-01T-06:30'), 'year'), - 'zoned vs (differently) zoned moment'); + assert.ok( + moment.parseZone('2013-02-01T00:00:00-05:00').isSameOrBefore(moment.parseZone('2013-02-01T00:00:00-06:30'), 'year'), + 'zoned vs (differently) zoned moment' + ); }); test('is same with invalid moments', function (assert) {