clinical-reasoning icon indicating copy to clipboard operation
clinical-reasoning copied to clipboard

Timezone inconsistency when constructing FHIR.DateTime

Open EvanMachusak opened this issue 1 year ago • 0 comments

Consider this CQL:

define "DateTime in GMT":
    DateTime(2022, 8, 8, 1, 30, 0, 0, 0)

define "FHIR DateTime in GMT":
    FHIR.dateTime { value: "DateTime in GMT" }

define "To Date":
    Date(year from "DateTime in GMT", month from "DateTime in GMT", day from "DateTime in GMT")

define "To Date from FHIR":
    Date(year from "FHIR DateTime in GMT", month from "FHIR DateTime in GMT", day from "FHIR DateTime in GMT")

The output of this code is:

DateTime in GMT=2022-08-08T01:30:00.000
To Date=2022-08-08
FHIR DateTime in GMT=dateTime
To Date from FHIR=2022-08-07

I ran this from a computer set to EST.

It appears that when constructing the FHIR.dateTime in CQL, the evaluator is converting the GMT dateTime to EST. This is inconsistent with constructed system dateTime types.

EvanMachusak avatar Aug 08 '22 12:08 EvanMachusak