Skip to content

Commit

Permalink
HTML-848 - Order widget should consider time of order expiry when det…
Browse files Browse the repository at this point in the history
…ermining whether it can be revised.
  • Loading branch information
mseaton committed Jan 9, 2025
1 parent 9096e12 commit d23c172
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public JsonObject constructJavascriptConfig(FormEntryContext context) {

JsonObject jsonConfig = new JsonObject();
jsonConfig.addString("fieldName", fieldName);
jsonConfig.addString("defaultDate", new SimpleDateFormat("yyyy-MM-dd").format(defaultDate));
jsonConfig.addString("defaultDate", getValueForProperty(defaultDate));
jsonConfig.addString("patientId", patId.toString());
jsonConfig.addString("encounterId", encId == null ? "" : encId.toString());
jsonConfig.addString("mode", context.getMode().name());
Expand Down Expand Up @@ -263,7 +263,7 @@ public String getValueForProperty(Object propertyValue) {
val = ((OpenmrsObject) propertyValue).getId().toString();
} else if (propertyValue instanceof Date) {
Date dateVal = (Date) propertyValue;
val = new SimpleDateFormat("yyyy-MM-dd").format(dateVal);
val = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(dateVal);
} else if (propertyValue instanceof Class) {
Class classValue = (Class) propertyValue;
val = classValue.getName();
Expand Down
8 changes: 8 additions & 0 deletions omod/src/main/webapp/resources/orderWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
if (!encDate || encDate === '') {
encDate = defaultDate;
}
if (encDate.length === 10) {
if (defaultDate.startsWith(encDate)) {
encDate = defaultDate;
}
else {
encDate += 'T00:00:00';
}
}
return encDate;
}

Expand Down

0 comments on commit d23c172

Please sign in to comment.