Uploaded image for project: 'FHIR Specification Feedback'
  1. FHIR Specification Feedback
  2. FHIR-34355

Datatype date/dateTime are not correct

    XMLWordPrintableJSON

Details

    • Icon: Change Request Change Request
    • Resolution: Not Persuasive with Modification
    • Icon: Highest Highest
    • FHIR Core (FHIR)
    • R4
    • Modeling & Methodology
    • Datatypes
    • 2.24.0.1
    • Hide

      We will not be changing the date datatype.

      We will change the dateTime datatype to:
      a) will allow time zone to be specified if only a date or partial date is specified
      b) the specified formats will be updated to indicate that a time zone is allowed on dates and partial dates
      c) update the Regular Expression in the specification and in the fhir schema to ensure that all valid dateTime instances are allowed

      NOTE: This appears to be the proper regular expression:
      ([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]+)?)?(Z|(+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?

      Show
      We will not be changing the date datatype. We will change the dateTime datatype to: a) will allow time zone to be specified if only a date or partial date is specified b) the specified formats will be updated to indicate that a time zone is allowed on dates and partial dates c) update the Regular Expression in the specification and in the fhir schema to ensure that all valid dateTime instances are allowed NOTE: This appears to be the proper regular expression: ( [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] +)?)?(Z|(+|-)((0 [0-9] |1 [0-3] ): [0-5] [0-9] |14:00)))?
    • Abdul-Malik Shakir / Grahame Grieve : 5-0-0
    • Correction
    • Non-compatible
    • R5

    Description

      This dateTime does not pass XML Schema validation (fhir-all.xsd):

      <date value="2021-11-21+01:00"/>
      

      This is because of the timezone part that is only accepted when at least an hour is present. Reading the spec it incorrectly says date SHALL not have timezone, and it does not say that for dateTime. Nonetheless this rule that violates common understanding of what a date/dateTime is, is enforced on dateTime as well

      A date with timezone is a valid date coming from current-date(), and xs:date. To fix, all that is required is to remove the additional pattern specification in the schema:

        <xs:simpleType name="date-primitive">
          <xs:restriction>
            <xs:simpleType>
              <xs:union memberTypes="xs:gYear xs:gYearMonth xs:date"/>
            </xs:simpleType>
            <!--<xs:pattern value="([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1]))?)?"/>-->
          </xs:restriction>
        </xs:simpleType>
      <!-- .. -->
        <xs:simpleType name="dateTime-primitive">
          <xs:restriction>
            <xs:simpleType>
              <xs:union memberTypes="xs:gYear xs:gYearMonth xs:date xs:dateTime"/>
            </xs:simpleType>
            <!--<xs:pattern value="([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[0-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]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?"/>-->
          </xs:restriction>
        </xs:simpleType>
      

      By not allowing timezone on date, FHIR makes simple things harder. My code `current-date()` now needs extending into `substring(string(current-date()), 1, 10)` in many places.

      Attachments

        Activity

          People

            GrahameGrieve Grahame Grieve
            ahenket Alexander Henket
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: