Question

10
Replies
1929
Views
STALIN A Member since 2011 3 posts
Monarch Info Tech Services Ltd
Posted: 4 years ago
Last activity: 4 years 2 months ago
Closed

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 12:00 AM but in Pega 7.1.7 it defaults to current time.


I verified the related Support Article SA-12489.


PegaSystems suggested the following change to make the time defaulted to "00:00"


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

<script>
try {
var dateTimeControlsIDs = [""];
debugger;
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 != "") {
return;
}
}
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);
}
</script>

2. Include this section, into the master section.

but this approach is not working. still the date time is set to current date time. Is there anything else we need to do to set the time to "12:00 AM"  or 00:00?


Message was edited by: Joe Stalin

Thanks for your response, I will check and reply you soon.

Joe Stalin

Low-Code App Development Upgrades User Interface Reporting System Administration
Moderation Team has archived post
Share this page LinkedIn