We use Angular 4 along with an MVC application written in the .net core. The data was obtained using the SignalR service, the hub is written in C #. The database contains a Datetime2 (7) (T-SQL) field, the resulting content looks like this (for a date field):
dueDt:"2017-10-02T08:54:00"
This is UTC time. We live in a +2 time zone. Now in the CSHTML file, we display this value as follows:
<small>Due: {{item.dueDt | date:'dd.MM.yy HH:mm'}}</small>
which show something like: 09/27/17 12:43 PM which is good, the problem is that our time zone is not +0, but +2, so it should display 14:43 as time.
I read somewhere that Angulars DatePipe uses the local time zone of clients, but it doesn't seem to be happening. (I tried this with chrome, firefox and Edge - there is no difference). Does anyone have an idea why this is happening or how can I tell Angular what the local time zone is? I tried to enable angular -moment, but it really doesn't work. (I can detail this if it seems important, but this is another problem).
source
share