Mozilla fire fox is throwing an error with joi date validation #2484
Open
Description
- is this issue currently blocking your project? (yes/no): yes
- is this issue affecting a production system? (yes/no):yes
Context
- node version: 12.19.0
- module version: "joi": "^17.2.1",
"react": "^16.13.1",
"@hapi/joi-date": "^2.0.1", - environment (e.g. node, browser, native):
- used with (e.g. hapi application, another framework, standalone, ...):
- any other relevant information:
The Schema which am using :
const Joi = require('joi');
const Schema = {
birthday: Joi.date().min('01-01-1960').max('12-31-2003').required()
}
It works fine in google chrome but in mozilla Its throwing an error,
The error is:"Error: date must have a valid date format or reference"
So, I tried to use format() like this:
const Schema = {
birthday: Joi.date().format('MM/DD/YYYY').min('01-01-1960').max('12-31-2003').iso().required()
}
But now mozilla firefox is Throwing:
Error: date must have a valid date format or reference
And google chrome is throwing:
Error: Unknown date format MM/DD/YYYY
Am trying to validate date with min and max date . so can someone please get me a solution for this.
Thanks in Advance