ComCool
ComCool

Reputation: 1103

Angular 2 and DatePipe with milliseconds

Why is 360000 Milliseconds shown as 01:06:00. It's only 6 minutes? It also looks like it remembers the first date pipe result and add this value to the next.

<p>
  {{ unit.StartToday * 1000 | date: "HH:mm:ss"}}<br/>
  {{ unit.DrivingTimeToday * 1000 | date: "HH:mm:ss"}}
</p>

http://plnkr.co/edit/46PdAjWsH5bk4KFIsvpV?p=preview

Upvotes: 0

Views: 3769

Answers (1)

Tiep Phan
Tiep Phan

Reputation: 12596

https://angular.io/docs/ts/latest/api/common/index/DatePipe-pipe.html

expression is a date object or a number (milliseconds since UTC epoch) or an ISO string

this is 6 minutes, but your GMT is +1, so it'll display 01:06:00. for me, GMT = +7 this app will print 07:06:00

my time

Upvotes: 2

Related Questions