json-schema
json-schema copied to clipboard
DateTimeFormats::duration seems to be buggy
Hi,
The regular expression defined in the class DateTimeFormats does not cover ISO 8601 encoded duration.
For example a duration like P2Y1D is not recognized as valid.
As far as I see the following regex should be rather applied for the format check:
^P(?!$)(\d+(?:\.\d+)?Y)?(\d+(?:\.\d+)?M)?(\d+(?:\.\d+)?W)?(\d+(?:\.\d+)?D)?(T(?=\d)(\d+(?:\.\d+)?H)?(\d+(?:\.\d+)?M)?(\d+(?:\.\d+)?S)?)?$
Thanks