org.hl7.fhir.core
org.hl7.fhir.core copied to clipboard
Allow downcasting of a dateTime to a date
When downcasting from a dateTime to a date the following error occurs:
HAPI-0389: Failed to call access method: org.hl7.fhir.exceptions.FHIRException: Exception executing transform tgt.value = cast(v, 'date') on Rule "dateTimeToDate": Invalid date/time string (datatype DateType does not support SECOND precision): 1961-12-24T16:55:34+02:00
I would expect https://github.com/hapifhir/org.hl7.fhir.core/blob/master/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/DateType.java#L100 to create a proper DateType even if it is a dateTime string but in this case ignore the time information.
Testable FML:
uses "http://hl7.org/cda/stds/core/StructureDefinition/TS" alias TS as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/date" alias date as target
group TSDate(source src : TS, target tgt : date) {
src.value as v -> tgt.value = cast(v, 'date');
}