Format number of seconds as mm:ss in Angular 2

Angular Date Pipe works with number value too,
But please note: Only with milliseconds.

If you want to get mm:ss(00:00) you need to convert your number value to milliseconds. In your case it should be: 3600 * 1000

<div class="time-box" *ngIf="p.value.playerTimer > 0">
    {{ p.value.playerTimer * 1000 | date:'mm:ss' }}
</div>

here is the Stackblitz example
https://stackblitz.com/edit/date-pipe-example-nhafvx

maybe someone will come in handy

Leave a Comment

techhipbettruvabetnorabahisbahis forumu