Support Article

Issue with pega:reference tags with custom datetime format

SA-37041

Summary



Custom datetime format is defined using a custom Control, for example, your_CustomDTFormat as yyyy-MM-dd'T'HH:mm:ss.

Using this custom datetime format with pega:reference tags for a non-autogenerated Section does not work correctly.

Including code like this:
<pega:reference name="$this.your_Date" format="your_CustomDTFormat" ></pega:reference>

Results in date output that looks like this: "Apr 19, 2017 08:44:33 AM"

This works correctly for an auto-generated HTML Section. In that case, the date output looks like this:
"2017-04-19T08:44:33"

Error Messages



Not Applicable


Steps to Reproduce



1. Create a custom Control and define the custom format.
2. Use the new Control inside a non-autogenerated HTML of a Section Rule to display DateTime property in read-only mode.


Root Cause



This is working as expected. Since the control is autogenerated, when referred inside an autogenerated section, it is markup is generated correctly (check the actions->view Java or at runtime inspect the element to find markup at runtime).

In the non-autogenerated section, user is referring to it in a Pega reference tag which will not generate the same markup.

Resolution



Perform the following local-change:

Pega's FormatDateTime Function of DateTime library supports java dateformat patterns and "yyyy-MM-dd'T'HH:mm:ss.SSSZ" is one of the java dateformat patterns.

So it is possible to get the value in these formats without using custom Controls inside a non-autogenerated HTML Section.

Published April 25, 2017 - Updated May 19, 2017


0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.