]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Write test for Feb 29 0000 validity
authorKunal Marwaha <marwahaha@berkeley.edu>
Wed, 29 Mar 2017 06:40:28 +0000 (02:40 -0400)
committerIskren Chernev <iskren.chernev@gmail.com>
Sun, 6 Aug 2017 23:29:10 +0000 (02:29 +0300)
src/test/moment/is_valid.js

index 3c040ecdff64eeb4ad09144314ef855750fc05cf..85bbd0c3a8cc07f0cd0ae062b0247b09b2c22e61 100644 (file)
@@ -15,6 +15,12 @@ test('array good month', function (assert) {
     }
 });
 
+test('Feb 29 0000 is valid', function (assert) {
+    // https://github.com/moment/moment/issues/3358
+    assert.ok(moment({year:0, month:1, date:29}).isValid(), 'Feb 29 0000 must be valid');
+    assert.ok(moment({year:0, month:1, date:28}).add(1, 'd').isValid(), 'Feb 28 0000 + 1 day must be valid');
+});
+
 test('array bad date', function (assert) {
     var tests = [
         moment([2010, 0, 0]),