Can i customize which date is valid
when give in the schema : "name": { "type": "string", "format":"date" } and transfer to validate this : "2019-10-12 07:20:50.52Z" "2019-10-12T07:20:50.52Z"
2 Question regarding date validator :
- what is wrong ?
- can it support other date format ? i.e. : 02 Aug 2022, 09:58 that should be supported - for some reason it fail...
can i give the date format a date format i want to support?
which is different from the :
private static final Pattern RFC3339_PATTERN = Pattern.compile(
"^(\d{4})-(\d{2})-(\d{2})" // yyyy-MM-dd
+ "(Tt:(\d{2}):(\d{2})(\.\d+)?)?" // 'T'HH:mm:ss.milliseconds
+ "([Zz]|([+-])(\d{2}):?(\d{2}))?");
Thank u !
The date and date-time format in JSON is standard, and it is not recommended to use other formats. If you have to do that, make it just a regular string and validate it with regex.