I'm trying to add a timer using the function, but it's working fine in windows, but showing the wrong timer in IOS.
enddate = "2023-04-25 00:00:00";
getEventTimer() {
setInterval(() => {
if(this._diff > 0) {
this._days = this.getDays(this._diff);
this._hours = this.getHours(this._diff);
this._minutes = this.getMinutes(this._diff);
this._seconds = this.getSeconds(this._diff);
} else {
this._days = 0;
this._hours = 0;
this._minutes = 0;
this._seconds = 0;
}
const s:any = new Date(this.enddate.toLocaleString().replace(/-/g, "/"));
const t:any = new Date(new Date().toLocaleString().replace(/-/g, "/"));
this._diff = s - t;
}, 1000);
}
getDays(t) {
return Math.floor(t / (1000 * 60 * 60 * 24));
}
getHours(t) {
return Math.floor((t / (1000 * 60 * 60)) % 24);
}
getMinutes(t) {
return Math.floor((t / 1000 / 60) % 60);
}
getSeconds(t) {
return Math.floor((t / 1000) % 60);
}
..................................................................................................................................
expecting the correct timer.