MatchesXsDateTimeStampUtc🔗
Check that
text
conforms to the pattern of an xs:dateTimeStamp
.
The time zone must be fixed to UTC. We verify only that the text
matches
a pre-defined pattern. We
do not
verify that the day of month is
correct nor do we check for leap seconds.
Code
digit = '[0-9]'
yearFrag = (
f'-?(([1-9]{digit}{digit}{digit}+)|(0{digit}{digit}{digit}))'
)
monthFrag = (
'((0[1-9])|(1[0-2]))'
)
dayFrag = (
f'((0[1-9])|([12]{digit})|(3[01]))'
)
hourFrag = (
f'(([01]{digit})|(2[0-3]))'
)
minuteFrag = (
f'[0-5]{digit}'
)
secondFrag = (
f'([0-5]{digit})(\\.{digit}+)?'
)
endOfDayFrag = (
'24:00:00(\\.0+)?'
)
timezoneFrag = 'Z'
dateTimeStampLexicalRep = (
f'{yearFrag}-{monthFrag}-{dayFrag}T(({hourFrag}:{minuteFrag}:{secondFrag})|{endOfDayFrag}){timezoneFrag}'
)
pattern = (
f'^{dateTimeStampLexicalRep}$'
)
return match(
pattern,
text
) is not None