Skip to content

Commit

Permalink
reformat datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
dprzybyl committed Nov 2, 2023
1 parent bc690c0 commit 21f84ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -239,17 +238,17 @@ private void setProperty(String name, Object value) throws PersistenceException
ResourceResolver resolver = resource.getResourceResolver();
boolean compositeNodeStore = RuntimeUtils.determineCompositeNodeStore(resolver);
if (!compositeNodeStore || !PathUtils.isAppsOrLibsPath(path)) {
ModifiableValueMap vm = resource.adaptTo(ModifiableValueMap.class);
ResourceMixinUtil.addMixin(vm, ScriptNode.APM_SCRIPT);
vm.put(name, convertValue(value));
ModifiableValueMap valueMap = resource.adaptTo(ModifiableValueMap.class);
ResourceMixinUtil.addMixin(valueMap, ScriptNode.APM_SCRIPT);
valueMap.put(name, convertValue(value));

resolver.commit();
}
}

private Object convertValue(Object obj) {
if (obj instanceof Date) {
Calendar calendar = new GregorianCalendar();
Calendar calendar = Calendar.getInstance();
calendar.setTime((Date) obj);

return calendar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
<a href="${item.scriptContentPath}" download="${item.scriptName}"
style="text-decoration:none; color:#4b4b4b">${item.scriptName}</a>
</td>
<td is="coral-table-cell" value="${item.executionTime.time || 0}">
<time datetime="${item.executionTime.time || 0}"
data-sly-test="${item.executionTime}"
<td is="coral-table-cell" value="${item.executionTime.timeInMillis || 0}">
<time data-sly-test="${item.executionTime}" datetime="${item.executionTime.timeInMillis || 0}"
data-sly-use.execLast="${'com.adobe.cq.xf.ui.DateFormatter' @ date=item.executionTimeCalendar, simpleFormat='yyyy-MM-dd HH:mm:ss'}">
${execLast.date}
</time>
Expand Down

0 comments on commit 21f84ae

Please sign in to comment.