Discussion
Pegasystems Inc.
US
Last activity: 5 Jul 2021 8:52 EDT
configure a time property rendered as dropdown to always use 24 hour format
The datetime control provides the ability to render a time property either as a set of dropdown or as an input field with a calendar.
When picking the presentation mode to render as a "dropdown lists", the user locale will be used to determine if the time should be rendered in a 12 hour or 24 hour format. Most of the en_XX locale will be using the 12 hour format and display 3 dropdowns with the last one being used for AM,PM.
Some applications like to use the 24h format and only display 2 dropdowns. It is possible to override the default presentation of the time format associated with a locale by overriding the object pega.u.d.CalendarUtil
This is a snapshot of this object using the fr_FR locale
this is a snapshot of the object using the en_US locale
to find the value of this object, just open the developer tools when in the end user portal and type 'pega.u.d.CalendarUtil'
to override these values, you can either attach a JS file to your portal harness (if you want the change to only apply to this portal) or make a change in userWorkform (this will apply to all apps including the studios)
If you want to apply it everywhere, you resave the rule UserWorkform in your application rule and copy / paste the lines below:
<script>
pega.u.d.CalendarUtil.localeFormats["dateTime"]="dd/MM/yyyy HH:mm";
pega.u.d.CalendarUtil.localeFormats["time"]="HH mm";
pega.u.d.CalendarUtil.timeSeq=["H","m"];
</script>