Search code examples
angularangular11date-pipe

How to use angular DatePipe with 0 value?


I've been try to use angular DatePipe to convert number to date, but I think there is something wrong. I don't know where ("maybe some bug").

For an example in my typescript:

const ONE_SECOND = 1000
setInterval(() => {
  this.dateInTime  += ONE_SECOND
}, ONE_SECOND);

My HTML:

<h4 class="text-primary">
  Result: {{ dateInTime | date: 'HH : mm : ss' }}
</h4>

I really hope the result is: 00:00:00 but it's not like that. I got the result always: 07:00:00.

I don't know where's the mistake of my code. Maybe someone can help me.

Thanks in advance.


Solution

  • Use timezone definition. Your timezone is +7

    Result: {{ dateInTime | date: 'HH : mm : ss':'+0' }}