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:
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)) } } } }