I use below code to print the time duration:
{{(endTime - startTime) * 1000 | date: 'H:mm:ss'}}
But I get the time of GMT +8
AngularJS has any way to print out the non-convert duaration, Or I need to use this way to do this?
{{(endTime - startTime) % (60 * 60 * 24) / (60 * 60) | number: 0}}:
{{(endTime - startTime) % (60 * 60) / 60 | number: 0}}:
{{(endTime - startTime) % 60 | number: 0}}
In AngularJS 1.3 and up, there is optional timezone argument in date filter. The doc says If the timezone is not specified, the timezone of the browser will be used.
https://code.angularjs.org/1.3.0/docs/api/ng/filter/date
Adding 'UTC' timezone will print the duration.
{{(endTime - startTime) | date: 'H:mm:ss': 'UTC'}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With