I need to add a clock to a web page. The clock needs to be synchronized with a server but I really don\'t want to have it constantly check the server as the page will be ope
you just get one time date time from server, on load call this method and use moments js for format date:
var timeMiliSecond = new Date(serverTime).getTime();
callRepeatedly() {
setTimeout(() => {
timeMiliSecond = timeMiliSecond+1000;
serverTime=moment(newDate(timeMiliSecond)).format('MM-DD-YYYY HH:mm:ss');
this.callRepeatedly();
}, 1000)
}