1 import { Pipe, PipeTransform } from '@angular/core'
3 // Thanks: https://stackoverflow.com/a/46055604
6 name: 'myVideoDurationFormatter'
8 export class VideoDurationPipe implements PipeTransform {
9 transform (value: number): string {
10 const minutes = Math.floor(value / 60)
11 const hours = Math.floor(minutes / 60)
14 return hours + ' h ' + (minutes - hours * 60) + ' min ' + (value - (minutes - hours * 60) * 60) + ' sec'
17 return minutes + ' min ' + (value - minutes * 60) + ' sec'