diff --git a/src/lib/isDate.js b/src/lib/isDate.js index ede3e33e6..3a1e4afd2 100644 --- a/src/lib/isDate.js +++ b/src/lib/isDate.js @@ -28,6 +28,7 @@ export default function isDate(input, options) { options = merge(options, default_date_options); } if (typeof input === 'string' && isValidFormat(options.format)) { + if (options.strictMode && input.length !== options.format.length) return false; const formatDelimiter = options.delimiters .find(delimiter => options.format.indexOf(delimiter) !== -1); const dateDelimiter = options.strictMode diff --git a/test/validators.test.js b/test/validators.test.js index 6b61c18b7..08d76f821 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -14001,6 +14001,7 @@ describe('Validators', () => { new Date([2014, 2, 15]), new Date('2014-03-15'), '29.02.2020', + '02.29.2020.20', '2024-', '2024-05', '2024-05-',