Currently, _parse_xsd_datetime() and _parse_xsd_time() in basyx/aas/model/datatypes.py crash with ValueError: hour must be in 0..23 whenever they encounter the XSD end-of-day midnight notation 24:00:00.
Both functions pass the parsed hour integer directly to Python's datetime.datetime / datetime.time constructors, which do not accept values above 23. There is no special-casing for the 24:00:00 form.
However, W3C XSD 1.0 explicitly permits 24:00:00 for both xs:dateTime and xs:time as end-of-day midnight:
- For
xs:dateTime, YYYY-MM-DDT24:00:00 is canonically equivalent to YYYY-MM-(DD+1)T00:00:00
- For
xs:time, 24:00:00 normalizes to 00:00:00. XSD 1.0 requires that when the hour is 24, minutes and seconds must both be 00.
In any case, the AAS schemas allow for hour 24, so we need to allow for it.
I think we should automatically convert this edge case into valid datetime.datetime (which btw follows ISO 8601).
Currently,
_parse_xsd_datetime()and_parse_xsd_time()inbasyx/aas/model/datatypes.pycrash withValueError: hour must be in 0..23whenever they encounter the XSD end-of-day midnight notation24:00:00.Both functions pass the parsed hour integer directly to Python's
datetime.datetime/datetime.timeconstructors, which do not accept values above 23. There is no special-casing for the24:00:00form.However, W3C XSD 1.0 explicitly permits
24:00:00for bothxs:dateTimeandxs:timeas end-of-day midnight:xs:dateTime,YYYY-MM-DDT24:00:00is canonically equivalent toYYYY-MM-(DD+1)T00:00:00xs:time,24:00:00normalizes to00:00:00. XSD 1.0 requires that when the hour is 24, minutes and seconds must both be 00.In any case, the AAS schemas allow for hour 24, so we need to allow for it.
I think we should automatically convert this edge case into valid
datetime.datetime(which btw follows ISO 8601).