Skip to content

Commit

Permalink
Fix invalid ISO format dates in the test suite.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
markstos committed Oct 19, 2016
1 parent 43594d5 commit 1b6e497
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/test/moment/is_same.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down
4 changes: 2 additions & 2 deletions src/test/moment/is_same_or_after.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down
8 changes: 5 additions & 3 deletions src/test/moment/is_same_or_before.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1b6e497

Please sign in to comment.