Time is showing wrong in html template binding

#1

Hello, on an android device, this code shows the correct time, but in iOS, its showing wrong

{{item.date | date:‘HH:mm’ }}

My timezone is -0300 but how i configure it in the code?

e.g
android 16:20
ios 14:20

#2

Any idea about this problem?

#3

Have you set the same timezone on both devices?

#4

Yes, same timezone on devices, in the project should I configure something?

#5

Take a look at the domumentation, You can configure the timezone

https://angular.io/api/common/DatePipe#description

{{item.date | date:‘HH:mm’:'CET' }}

#6

I had a conversation with a poster here, who said that i18n didn’t work well with iOS, so the Angular date pipe had issues, and that’s why he used date-fns instead for his date pipe. Not sure how to find the link. But you might want to use date-fns or moment, instead of the Angular date pipe.

#7

Which version of angular are you using? The date pipe changed in the 5.0.0 release.

#8

Hello, I use ‘UTC’, but in this way, works in iOS, but doesnt work in android, without timezone configured, works in Android but not in iOS.

thanks for the reply

#9

I update to angular 5.1.2, still the same thing.

#10

So u made work for both devices. What about the dirty way and implement both versions and only Show the correct one with showWhen="ios"? :smiley:

#11

The Date Pipe library from @AaronSterling might help. See Date Pipe library

#12

Im gonna take a look, thanks

#13

Any luck with this. I’m trying to use the datepipe transform to format the date differently.
I have angular 5.0.0

On ios it doesn’t seem to look at the timezone at all. its always 5-6 hours behind.