hapijs / hapijs/joi

Mozilla fire fox is throwing an error with joi date validation

Open
#2,484 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
21.2k
Forks
1.5k
Avg merge
4h 57m
Merged PRs (30d)
14

Description

@hueniverse

* *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**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.