Closed jeremy-viyamd closed 3 months ago
Note that the example "2024-07-23T12:27:16.321661"
above does not include a time zone, which must always be given if a time is present, so this particular case should indeed fail.
my understanding is that we're adhering to the fhir spec regex for dateTime, which is also suggested by this comment
the fhir spec regex for dateTime is ([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]{1,9})?)?)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)?)?)?
i checked my example string using regex101 and it matches the full regex: https://regex101.com/r/bLeTE5/1
so even though the time zone is not included, this particular case should succeed because it matches the full fhir spec regex for dateTime
nevermind, the fhir spec says "If hours and minutes are specified, a timezone offset SHALL be populated."
weird, because the provided regex allows timezone offset to be omitted
You're right! That's an issue in R5 and newer, I've filed it here: https://jira.hl7.org/browse/FHIR-46453
Overview
FHIRDateTime does not check expected format of input string properly
Example
the string
"2024-07-23T12:27:16.321661"
matches the full regex in the fhir spec for dateTimehowever, the following code
reports the following error
Root Cause
the regex in the fhir spec for dateTime is not equivalent to the regex used to check the format, which was introduced in #166