Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Date Time field defaults to current time after upgrade



Issue with the Date-Time Calendar after upgrading from PRPC 6.1 to Pega 7.1.7. In the earlier version, the time is defaulted to 0:00 AM but in Pega 7.1.7 it defaults to current time.

Error Messages

Not Applicable

Steps to Reproduce

1. Add Date Time control to a Date Time type property.
2. On clicking the Date calendar field the time is defaulted to current time which was not the case in PRPC 6.1.

Root Cause

The root cause of this problem is a defect in custom application code/rules.  


This issue is resolved through the following local-change:

1. Create a non-auto generated section with below code.

try {
var dateTimeControlsIDs = [""];
for (var idx = 0; idx < dateTimeControlsIDs.length; idx++) {
var iconSpanObj = document.getElementById(dateTimeControlsIDs[idx]);
if (iconSpanObj) {
pega.util.Event.removeListener(iconSpanObj, 'click', setDefaultHoursAndMinutes);
pega.util.Event.addListener(iconSpanObj, 'click', setDefaultHoursAndMinutes);
} catch(e) { }
function setDefaultHoursAndMinutes(event) {
var _element = pega.util.Event.getTarget(event);
setTimeout(function() {
if (_element && _element.parentNode) {
var inputElem = pega.util.Dom.getFirstChild(_element.parentNode);
if (inputElem && inputElem.value != "") {
var hoursDropObj = document.getElementById("hourDrop");
if(hoursDropObj) {
var listLength = hoursDropObj.options.length;
for (var i = 0; i < listLength; i++) {
if (hoursDropObj.options[i].value == 0) {
hoursDropObj.options[i].selected = true;
hoursDropObj.options[i].defaultSelected = true;
var minuteDropObj = document.getElementById("minuteDrop");
listLength = minuteDropObj.options.length;
for (var i = 0; i < listLength; i++) {
if (minuteDropObj.options[i].value == 0) {
minuteDropObj.options[i].selected = true;
minuteDropObj.options[i].defaultSelected = true;
}, 100);

2. Include this section, into the master section, where you want to use the 0:00 time settings.

Published July 30, 2015 - Updated October 8, 2020

Was this useful?

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.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us