validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

IsDate method doesn't work only with dot delimiter

Open Adudarchyk opened this issue 3 years ago • 1 comments

Describe the bug I want to format yes you DD.MM.YYYY for the isDate method, with only dots as separator. But you need to make a strange design: const isExistingDate = validator.isDate(date, { format: 'DD-MM-YYYY', delimiters: ['-', '.'], }); Why can't work without "-" or "/"?

Examples working: const isExistingDate = validator.isDate(date, { format: 'DD-MM-YYYY', delimiters: ['-', '.'], }); does not work: const isExistingDate = validator.isDate(date, { format: 'DD.MM.YYYY', delimiters: ['.'], }); Additional context Validator.js version: 13.7.0 Node.js version: 17.4.0 OS platform: [windows, linux, macOS, etc] macOS

Adudarchyk avatar Mar 21 '22 08:03 Adudarchyk

Tried to recreate with macOS & your exact Node.js and Validator.js versions but it worked flawlessly.

Are all dates you're trying to validate only working when you add another delimiter besides a dot? Or are there any specific dates not working with only the dot specified as a delimiter?

Is the date input ensured to be a string?

bennetfabian avatar Mar 25 '22 00:03 bennetfabian