Skip to content

Wrong Expected Outcome for ToString of DateTime with No Offset Specified #73

@cmoesel

Description

@cmoesel

The test CqlStringOperatorsTest.toString tests.DateTimeToString2 specifies the following CQL:

ToString(DateTime(2000, 1, 1, 15, 25, 25, 300))

and expected outcome '2000-01-01T15:25:25.300'.

When I run this through the TypeScript/JavaScript engine, I get the result 2000-01-01T15:25:25.300+00:00 because we run the tests using UTC-based evaluation request timestamps.

In the CQL specification, Constructing Date and Time Values says:

The only component that is ever defaulted is the timezone offset component. If no timezone offset component is supplied, the timezone offset component is defaulted to the timezone offset of the timestamp associated with the evaluation request.

This means that DateTime(2000, 1, 1, 15, 25, 25, 300) does have an offset, even if it was not supplied in the constructor. As such, I think it is reasonable (if not required) for the resulting string representation to also have an offset corresponding to the default offset.

Either the test should be updated so the input has an offset, or the test framework should declare what offset to run under, or the spec needs to be clarified about what's expected in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CQLTest: CQL-test-codeActual tests stored or changed in this repo. Closed through PR and no HL7 balloting required.bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions