as the title states, how to allow an empty Date-String through Joi validation.
When adding:
Date: ""
it gets the Issue: message: ""Date" must be a number of milliseconds or valid date string"
with this Joi-Validation:
"Date": Joi.date().required().allow("").allow(null).options(validationErrors);
Question: How can an empty Date-String be allowed through Joi validation?
EDIT: By removing: .required()
and or adding .default("")
i do get another error, when adding Date: ""
, Cannot set parameter at row: 1. Wrong input for DATE type
Valid: Either
new Date()
or""
(empty string)joi
version 17.2.1