Skip to content
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

[BUG] Regex for xs:dateTime does not properly support timezones #498

Open
mjacoby opened this issue Dec 11, 2024 · 2 comments
Open

[BUG] Regex for xs:dateTime does not properly support timezones #498

mjacoby opened this issue Dec 11, 2024 · 2 comments
Assignees
Labels
bug Something isn't working JSON impatc on JSON only Schemas generated schemata for xml, JSON and rdf or XMI

Comments

@mjacoby
Copy link

mjacoby commented Dec 11, 2024

Describe the bug
The regex for values of type xs:dateType

^-?(([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9]))-((0[1-9])|(1[0-2]))-((0[1-9])|([12][0-9])|(3[01]))T(((([01][0-9])|(2[0-3])):[0-5][0-9]:([0-5][0-9])(\\.[0-9]+)?)|24:00:00(\\.0+)?)(Z|\\+00:00|-00:00)

does only allow Z, +00:00, or -00:00 as timezones.
Correct behavior would be to allow Z or any other timezone of format (+|-)[0-9]{2}:[0-9]{2}.

Where

  • "pattern": "^-?(([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9]))-((0[1-9])|(1[0-2]))-((0[1-9])|([12][0-9])|(3[01]))T(((([01][0-9])|(2[0-3])):[0-5][0-9]:([0-5][0-9])(\\.[0-9]+)?)|24:00:00(\\.0+)?)(Z|\\+00:00|-00:00)$"
  • "pattern": "^-?(([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9]))-((0[1-9])|(1[0-2]))-((0[1-9])|([12][0-9])|(3[01]))T(((([01][0-9])|(2[0-3])):[0-5][0-9]:([0-5][0-9])(\\.[0-9]+)?)|24:00:00(\\.0+)?)(Z|\\+00:00|-00:00)$"

Additional context
https://www.w3.org/TR/xmlschema-2/#dateTime Section 3.2.7.3

@mjacoby
Copy link
Author

mjacoby commented Dec 13, 2024

This is actually more complex as I described in aas-core-works/aas-core-meta#355 (comment)

Copying my response from there

The specification says the following for basicEventElement.lastUpdate

image

The issue here is that the Type is dateTime which is defined as xs:dateTime, meaning it can have any timezone. However, the explanation column states that the timestamp should/must(?) be in UTC. Based on that you introduced a new "type" Date_time_UTC. I would argue that the specification is wrong or at least inconsistent as the type information is constrained by the explanation to an undefined type "dateTimeUTC". The correct way to handle this would be to change the specification to either defined the type dateTimeUTC or to remove the UTC restriction in the explanation.

@s-heppner
Copy link
Collaborator

I imagine to remember that there was once a decision that the timestamps must all be defined in UTC, but maybe @BirgitBoss could clarify this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working JSON impatc on JSON only Schemas generated schemata for xml, JSON and rdf or XMI
Projects
None yet
Development

No branches or pull requests

3 participants