Support Article
Date Time control changes format after property recalculation
SA-21950
Summary
A pxDateTime control is configured to display using read only formatting only the date portion dd.mm.yyyy of a DateTime property, where the value is calculated using a declare expression.
This works initially but the format switches to a different one including the time when the section is reloaded.
Error Messages
Not Applicable
Steps to Reproduce
Configure a date time property with a value set to a declare expression to display as read only.
Root Cause
Date time custom formats and Date formats are not supported as read only for use through declare expressions.
Resolution
Perform the following local-change:
- Create a new Text property to contain the string value of the date.
- Define a new declare expression to populate this string based on the date or time property.
For example here the value of DateTime1_Text property is set to be the date from DateTime1, which is formatted to dd.MM.yyyy
At runtime, one can see that the Text value retains the formatting.
Published April 3, 2017 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.