Closed heidivanparys closed 5 months ago
Thank you for pointing this out, Heidi.
Rather than inventing a new format, I propose to just update the regular expressions, so that the time-offset is mandatory there:
^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d)?(Z|((\+|-)\d{2}:\d{2}))$
^\d{2}:\d{2}:\d{2}(\.\d)?(Z|((\+|-)\d{2}:\d{2}))$
Since this is only a recommendation, a community can use a pattern with optional time-offset.
@heidivanparys Do you agree?
@jechterhoff Ok with me.
According to recommendation 3 (/req/core/format-and-pattern), the value of a property with
DateTime
as type in the UML model can be a local datetime.The regular expression (
^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d)?(Z|((\+|-)\d{2}:\d{2}))?$
) indicates this, and it also confirmed in the note “However, applications may also use different regular expressions. For example, a community may choose to only allow date time values in Zulu time (i.e., requiring the time zone designator to always be ‘Z’).”.JSON Schema Validation: A Vocabulary for Structural Validation of JSON states:
From RFC 3339:
and also relevant are the following:
So, as far as I can see, using
format=date-time
as specified in JSON Schema Validation: A Vocabulary for Structural Validation of JSON implies using a datetime in UTC or a datetime with a UTC offset specified.That would mean that the regular expression for DateTime should be updated.
Perhaps a format for local datetimes could be defined by the best practice (allowed according to https://json-schema.org/draft/2020-12/json-schema-validation.html#name-custom-format-attributes)?