]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Fix invalid ISO format dates in the test suite.
authorMark Stosberg <mark@rideamigos.com>
Wed, 19 Oct 2016 13:42:23 +0000 (09:42 -0400)
committerIskren Chernev <iskren.chernev@gmail.com>
Sun, 6 Nov 2016 09:37:33 +0000 (01:37 -0800)
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.

src/test/moment/is_same.js
src/test/moment/is_same_or_after.js
src/test/moment/is_same_or_before.js

index 150194ee2dc1a3e0a2ff2f55766d98f45bfa685a..e0d92ba3b77720d4c9b018514cd2c634931e1cb3 100644 (file)
@@ -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');
 });
 
index 7e096139b6266570e1ecf353974ca0b68dcd289e..b1200b5ba829a0ab79566ad58655a8067e740d90 100644 (file)
@@ -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');
 });
 
index 6a341ae456f0867e295e7071d6820c97f3176913..b530f7c5f1888f8d9239cb2d66862fe8c374c43b 100644 (file)
@@ -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) {