Angular 4 date pipe displays wrong date because of time zones - how to fix this?

前端 未结 3 1074
[愿得一人]
[愿得一人] 2020-11-29 03:24

I have a date value in each of my objects that I can Print like this:

 {{competition.compStart }}

And here is how it l

3条回答
  •  执笔经年
    2020-11-29 03:52

    for angular 5 and up , you can try to add timezone in pipe,

    By default it takes the local timezone of user machine

    and you can specify it in minutes for example for GMT-2, timezone: '-120'

    {{ competition.compStart | date: 'short' : '-120'}}
    

提交回复
热议问题