Js countdown to Synchronize

js countdown Synchronize question when my two users, Synchronize, open this page, their countdown time will be a few seconds apart.
PS: how should I write this countdown
PS:? is there something wrong with my writing?

      let expires_at = new Date(this.order.expires_at.replace(/-/g, "/"));  // 
      let myDate = new Date()//
      let ms = expires_at-myDate   //
      let mm = parseInt(ms/60000)//
      let mss = ms%60          //
      this.minutes = mm
      this.seconds =  mss
      a()
      
   function a(){   
     setInterval(()=>{
           if (this.seconds == 0 && this.minutes != 0) {
          this.seconds = 59;
          this.minutes -= 1;
        }else if(this.minutes == 0 && this.seconds == 0){
          this.seconds = 0;
        
          clearInterval();

        }else{
          this.seconds -= 1
        }
      },1000);
      }
Mar.16,2021

there's nothing wrong with the way you write it.

you open your console, print the current time, then set your computer's time to another time, and then print the current time on the console, and you will see what the problem is.

Menu