diff --git a/src/lib/isISO8601.js b/src/lib/isISO8601.js index 6eea9ae27..d8809a671 100644 --- a/src/lib/isISO8601.js +++ b/src/lib/isISO8601.js @@ -11,7 +11,7 @@ const isValidDate = (str) => { // this check is meant to catch invalid dates // like 2009-02-31 // first check for ordinal dates - const ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/); + const ordinalMatch = str.match(/^[\+-]?(\d{4})-?(\d{3})([ T]{1}\.*|$)/); if (ordinalMatch) { const oYear = Number(ordinalMatch[1]); const oDay = Number(ordinalMatch[2]); diff --git a/test/validators.test.js b/test/validators.test.js index 98d2a12ff..61003c5bd 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -12443,6 +12443,9 @@ describe('Validators', () => { '2009-222', '2020-366', '2400-366', + '+2009-145', + '+2009-130', + '-2009-145', ], invalid: [ '2010-02-30',