2

I have a datetime returning as "2016-12-20T19:00:00" and am using a the following pipe on it: {{ dateObj | date:'shortTime' }} I want/expect that to display as 7:00 PM, but it instead is displaying as 1:00 PM. Is this a bug with Angular, or am I doing something wrong?

Bryan
  • 2,951
  • 11
  • 59
  • 101
  • What timezone are you in? What timezone do you think that time is in? – jonrsharpe Dec 22 '16 at 20:47
  • You should definitely suspect a timezone issue. Angular 2 DatePipe spits out localized time. – trey-jones Dec 22 '16 at 20:48
  • 3
    The date, apparently, is considered as a UTC date. See http://plnkr.co/edit/SuqPiZKl2P4viJLN7c5i?p=preview. You should specify a timezone offset, and prefer returning UTC dates from your API. – JB Nizet Dec 22 '16 at 20:51
  • @JBNizet DatePipe Timezone offsets don't seem to work, even the verbatim examples from the DatePipe documentation don't change the displayed time.... – Douglas Gaskell Nov 29 '17 at 05:23

0 Answers0