Skip to content
Advertisement

Tag: ajv

Validate UTC date/date-time with ajv but allow empty strings

I need to validate string schema format: “date” or format: “date-time” to accept only ISO 8601 but also allow empty string “” (the “” requirement should be separately checked using the required schema). However, the native ajv format parser does not allow empty string “” to pass. How do I make it allow empty string, and still validate ISO 8601?

Advertisement