New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to allow date strings to have a value of empty string ("") ? #1519
Comments
Is it possible to remove the validation for fields with format = "date" ? |
Sounds tricky... What's possible is to define
Or you could use @SamSedivy Do you validate the data on the server also? Is an empty string valid? @germanbisurgi any ideas? Is it possible to override the validation? |
The problem is that json-editor shouldn't use With {
"type": "string",
"description": "Format 'YYYY-MM-DD', or empty.",
"pattern": "^(|\\d{4}-\\d{2}-\\d{2})$"
} with {
"type": "string",
"description": "Format 'YYYY-MM-DD', or empty.",
"oneOf": [
{
"title": "Date Format",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
{
"title": "Empty String",
"pattern": "^$"
}
]
} |
This has bitten me as well. Previously, this schema has worked fine:
Now it already fails when initializing the editor for a new object. Changing EDIT: The big problem is that the initialization fails and the |
General information
Is it possible to allow date strings to have a value of empty string ("") ? I have date fields that aren't required and their values are empty strings. I don't want to validate them. I want to have date fields that aren't required.
^2.14.1
Expected behavior
Allow fields of type: string format: date to have the value ""
Actual behavior
Fields of type: string format: date show this error
Date must be in the format "YYYY-MM-DD".
Steps to reproduce the behavior
Use a startval of "" (empty string) for a field that is type: string format: date
Direct link to example: https://json-editor.github.io/json-editor/
The text was updated successfully, but these errors were encountered: