Calculer le temps en secondes javascript angulaire

// Calculate response time in seconds
let startFrom = new Date().getTime();
let seconds = Math.round(new Date().getTime() - startFrom) / 1000;
console.log(`Time: ${seconds}s`);

// Example: Calculating Angular service call's response time:
calculateTime(param: any) {
  let startFrom = new Date().getTime();
  
  this.myService.getData(param).subscribe(
    (res) => {
      let seconds = Math.round(new Date().getTime() - startFrom) / 1000;
      console.log(`Time: ${seconds}s`);
    },
    (error) => {
      // etc
    })
}
Banana in Transit