I have an app with an Angular 7 front end and a back-end consisting of a Microsoft Web API utilizing Entity Framework Code First connected to a sql database. I have a column with data stored as a DATE type. When I access the data using {{myDate}}
it displays 2020-04-05T00:00:00Z
, but if I use {{myDate | date}}
it displays 4/04/20
.
The first date April 5th is correct, but the second date created via the pipe is displaying April 4th.
There is no issue from angular. I suspect it's because of your timezone
A timezone offset (such as '+0430'),
or a standard UTC/GMT or continental US timezone abbreviation.
**When not supplied, uses the end-user's local system timezone.**
Optional. Default is undefined.
For example in my case {{'2020-04-05T00:00:00Z' | date:'full'}}
gives Sunday, April 5, 2020 at 2:00:00 AM GMT+02:00
and {'2020-04-05T00:00:00Z' | date:'full':'UTC'}}
gives Sunday, April 5, 2020 at 12:00:00 AM GMT+00:00
I hope this helps.
Edit: full
parameter will help you debug your issue better and then once you resolve it you can render something nicer to the user.