mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-09 06:14:45 +00:00
Fix FHIRPath Date opPlus/Minus failures
This commit is contained in:
parent
b5cb29cc1b
commit
c222582b22
@ -2749,8 +2749,12 @@ public class FHIRPathEngine {
|
||||
} else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) {
|
||||
result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue()))));
|
||||
} else if ((l.isDateTime() || l.hasType("Date")) && r.hasType("Quantity")) {
|
||||
DateTimeType dl = l instanceof DateTimeType ? (DateTimeType) l : new DateTimeType(l.primitiveValue());
|
||||
result.add(dateAdd(dl, (Quantity) r, false, expr));
|
||||
if (l.hasType("Date")) {
|
||||
result.add(dateAdd((BaseDateTimeType) l, (Quantity) r, false, expr));
|
||||
} else {
|
||||
DateTimeType dl = l instanceof DateTimeType ? (DateTimeType) l : new DateTimeType(l.primitiveValue());
|
||||
result.add(dateAdd(dl, (Quantity) r, false, expr));
|
||||
}
|
||||
} else {
|
||||
throw makeException(expr, I18nConstants.FHIRPATH_OP_INCOMPATIBLE, "+", left.get(0).fhirType(), right.get(0).fhirType());
|
||||
}
|
||||
@ -3014,8 +3018,12 @@ public class FHIRPathEngine {
|
||||
result.add(qty.copy().setValue(qty.getValue().abs()));
|
||||
}
|
||||
} else if ((l.isDateTime() || l.hasType("Date")) && r.hasType("Quantity")) {
|
||||
DateTimeType dl = l instanceof DateTimeType ? (DateTimeType) l : new DateTimeType(l.primitiveValue());
|
||||
result.add(dateAdd(dl, (Quantity) r, true, expr));
|
||||
if (l.hasType("Date")) {
|
||||
result.add(dateAdd((BaseDateTimeType) l, (Quantity) r, true, expr));
|
||||
} else {
|
||||
DateTimeType dl = l instanceof DateTimeType ? (DateTimeType) l : new DateTimeType(l.primitiveValue());
|
||||
result.add(dateAdd(dl, (Quantity) r, true, expr));
|
||||
}
|
||||
} else {
|
||||
throw makeException(expr, I18nConstants.FHIRPATH_OP_INCOMPATIBLE, "-", left.get(0).fhirType(), right.get(0).fhirType());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user