Skip to content

Fix: Handle XSD end-of-day midnight notation 24:00:00#582

Open
paul-gerber-svg wants to merge 7 commits into
eclipse-basyx:developfrom
rwth-iat:xsd-midnight-24
Open

Fix: Handle XSD end-of-day midnight notation 24:00:00#582
paul-gerber-svg wants to merge 7 commits into
eclipse-basyx:developfrom
rwth-iat:xsd-midnight-24

Conversation

@paul-gerber-svg

Copy link
Copy Markdown

Before, parsing XSD timestamps with an hour of 24 causes a ValueError. Now, the parser in sdk/basyx/aas/model/datatypes.py correctly identifies 24:00:00 as midnight, handles the day rollover for DateTime, and normalizes Time to 00:00:00.

Unit tests for valid and invalid edge cases are added to sdk/test/model/test_datatypes.py inside TestDateTimeTypes.

Fixes #564

Before, parsing XSD timestamps with an hour of 24 causes a ValueError.
Now, the parser in `sdk/basyx/aas/model/datatypes.py` correctly identifies 24:00:00 as midnight, handles the day rollover for `DateTime`, and normalizes `Time` to 00:00:00.

Unit tests for valid and invalid edge cases are added to `sdk/test/model/test_datatypes.py` inside `TestDateTimeTypes`.

Fixes eclipse-basyx#564
Comment thread sdk/basyx/aas/model/datatypes.py Outdated
Comment on lines +626 to +627
res = DateTime(int(match[2]), int(match[3]), int(match[4]), hour, int(match[6]), int(match[7]),
microseconds, _parse_xsd_date_tzinfo(match[9]))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to use keyword arguments here? I don't know if DateTime supports this, but that's pretty hard to verify. I mean something like:

DateTime(
  year=int(match[2]),
  month=int(match[3]),
  day=int(match[4]), 
  hour=hour,
 ...
)

Comment thread sdk/basyx/aas/model/datatypes.py
Comment thread sdk/basyx/aas/model/datatypes.py
@s-heppner s-heppner added this to the Release 2.1.0 milestone Jul 6, 2026
@paul-gerber-svg paul-gerber-svg force-pushed the xsd-midnight-24 branch 3 times, most recently from 68765c6 to 54bc503 Compare July 6, 2026 14:26
@paul-gerber-svg paul-gerber-svg force-pushed the xsd-midnight-24 branch 2 times, most recently from 2d581f1 to f805fe6 Compare July 9, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants