export class VisitedRoute {
  route: string;
  timeStart: Date;
  timeEnd: Date;
  duration: number;

  constructor() {
  }

  getStartTimeString(){
    return this.timeStart.toISOString();
  }

  getEndTimeString(){
    return this.timeEnd.toISOString();
  }

  calcDuration(){
    this.duration = Math.abs(this.timeEnd.getTime() - this.timeStart.getTime());
  }

  getStringObject(){
    let visitedRouteObject = {};
    visitedRouteObject['route'] = this.route;
    visitedRouteObject['timeStart'] = this.timeStart.toISOString();
    visitedRouteObject['timeEnd'] = this.timeEnd.toISOString();
    visitedRouteObject['duration'] = this.duration;
    return visitedRouteObject;
  }

}
