Currently, the deserialization of the xsd types xs:dateTime and xs:date use the following regex:
DATETIME_RE = re.compile(
r"^(-?)(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(\.\d+)?([+\-](\d\d):(\d\d)|Z)?$"
)
DATE_RE = re.compile(r"^(-?)(\d\d\d\d)-(\d\d)-(\d\d)([+\-](\d\d):(\d\d)|Z)?$")
This requires any date number in both datatypes to have exactly four digits.
In contrast to this, states the definition of XML Schema 1.0 the following:
The ·lexical space· of dateTime consists of finite-length sequences of characters of the form: '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?, where
'-'? yyyy is a four-or-more digit optionally negative-signed numeral that represents the year; if more than four digits, leading zeros are prohibited, and '0000' is prohibited
Therefore, our implementation should also allow for xs:dateTime and xs:date with years that have more than four digits, disallowing leading zeros in that case.
Currently, the deserialization of the
xsdtypesxs:dateTimeandxs:dateuse the following regex:This requires any date number in both datatypes to have exactly four digits.
In contrast to this, states the definition of XML Schema 1.0 the following:
Therefore, our implementation should also allow for
xs:dateTimeandxs:datewith years that have more than four digits, disallowing leading zeros in that case.