import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'secToMin'
})
export class SecToMinPipe implements PipeTransform {

  transform(n:string): string {
    if(n.includes(':')){
        let h = n[0] + n[1];
        let m = n[3] + n[4];
        let s = n[6] + n[7];
        n = h + m + s;
    }
    let m = parseInt(n);
    return Math.trunc(m/60) + '\' ' + ((m%60)>0 ? (m%60 + '\'\'') : '00\'\'');
  }

}
