Angular used The PrimeNG V4.3.0 Calendar component and could not refresh the Calendar in real time according to the system time. It was found to be a problem with PrimeNG V4.3.0 and below. The new version has fixed the problem. But how can the Calendar component maintain the same system time every time it is clicked if the project cannot be upgraded to a new version? To do this, I wrote a public method to update the component in real time as follows: HTML: ts: onSelect1($event: any) { let zjhours = new Date($event).getHours(); // let newhours = new Date().gethours (); // let zjminutes = new Date($event).getminutes (); // let newminutes = new Date().getminutes (); // system minute let newDate = newDate ($event); Date(newDate.setHours(newhours,newminutes)); if (zjhours ! = newhours) { this.dataScore.editTaskCenterList.delayTime1 = new Date(newDate.setHours(zjhours, zjminutes)); document.getElementById(‘delayTime1’).querySelector(‘.ui-hour-picker span:nth-child(3)’).innerHTML = zjhours.toString(); document.getElementById(‘delayTime1’).querySelector(‘.ui-minute-picker span:nth-child(3)’).innerHTML = zjminutes.toString(); } else { if (zjminutes ! = newminutes) { this.dataScore.editTaskCenterList.delayTime1 = new Date(newDate.setHours(zjhours, zjminutes)); document.getElementById(‘delayTime1’).querySelector(‘.ui-hour-picker span:nth-child(3)’).innerHTML = zjhours.toString(); document.getElementById(‘delayTime1’).querySelector(‘.ui-minute-picker span:nth-child(3)’).innerHTML = zjminutes.toString(); } else { this.dataScore.editTaskCenterList.delayTime1 = new Date(newDate.setHours(newhours, newminutes)); document.getElementById(‘delayTime1’).querySelector(‘.ui-hour-picker span:nth-child(3)’).innerHTML = newhours.toString(); document.getElementById(‘delayTime1’).querySelector(‘.ui-minute-picker span:nth-child(3)’).innerHTML = newminutes.toString(); } } } onFocus1($event: any) { // debugger let h, m, delayTime1 = this.dataScore.editTaskCenterList.delayTime1; if (! DelayTime1) {// add h = new Date().gethours (); m = new Date().getMinutes(); } else {// edit h = new Date(delayTime1).gethours (); m = new Date(delayTime1).getMinutes(); } if (h && m) { document.getElementById(‘delayTime1’).querySelector(‘.ui-hour-picker span:nth-child(3)’).innerHTML = h.toString(); document.getElementById(‘delayTime1’).querySelector(‘.ui-minute-picker span:nth-child(3)’).innerHTML = m.toString(); // Check whether the time and minutes are less than two digits. If (h < 10) {let hours = 0

document.getElementById(‘delayTime1’).querySelector(‘.ui-hour-picker span:nth-child(2)’); hours.style.display = ‘inline’; } else { let hours =

document.getElementById(‘delayTime1’).querySelector(‘.ui-hour-picker span:nth-child(2)’); hours.style.display = ‘none’; } if (m < 10) { let minutes =

document.getElementById(‘delayTime1’).querySelector(‘.ui-minute-picker span:nth-child(2)’); minutes.style.display = ‘inline’; } else { let minutes =

document.getElementById(‘delayTime1’).querySelector(‘.ui-minute-picker span:nth-child(2)’); minutes.style.display = ‘none’; } } } delayOnClick1($event: any){ let element = $event.target; // console.log(“dom node: “, element); if (element.tagName == “A”) { let judged = element.className; var patt1 = new RegExp(“ui-state-default”); var patt2 = new RegExp(“ui-state-highlight”); var result1 = patt1.test(judged); var result2 = patt2.test(judged); if (result1 && result2) { let starts = this.dataScore.editTaskCenterList.delayTime1; let dmhours = parseInt(document.getElementById(‘delayTime1’).querySelector(‘.ui-hour-picker span:nth-child(3)’).innerHTML); //dom hour let dmminutes = parseInt(document.getelementById (‘delayTime1’).querySelector(‘.ui-minute-picker ‘) span:nth-child(3)’).innerHTML); //dom min let xthours = new Date().gethours (); // system hour let xtminutes = new Date().getminutes (); / / system minutes if (dmhours < xthours) {this. DataScore. EditTaskCenterList. DelayTime1 = new Date (starts. SetHours (xthours, xtminutes)) } if (dmminutes < xtminutes) { this.dataScore.editTaskCenterList.delayTime1 = new Date(starts.setHours(xthours, xtminutes)) } } } }