I have a working (in production) web app (material + angular 5 (5.2.11)). Also I've an API written in .dot core 2 (C#) using Nancy FX and newtonsoft json.
Problem:
DB (mariaDB running on Ubuntu Server): I have this value: 2018-05-16 20:42:36
on a record.
Calling the endpoint yields the correct JSON:
{"timestamp":"2018-05-16T20:42:36Z"}
(the other fields were removed for sanity)
On Angular app I use:
... return this._http.get(this.endpoint + '/' + uuid, { headers: this._getHeaders }).catch(this.handleError);
Where <T>
represents a model that includes timedate: Date;
as a property.
Using the service:
this._dataService.getByUuid(uuid).subscribe(result => { console.log(result); });
gives:
Object { timedate: "2018-05-16 08:05:36" }
So, the time lacks of AMPM format and I can't display it correctly. {{element.timedate | date: 'dd/MM/yyyy HH:mm' }}
does nothing since timedate
is just that, a bare string.
What have I tried:
- Implementing a different format in JSON output (in NancFx API)
- Adding a HTTP INTERCEPTOR
- Reading this
- Declaring the properties as Date, String
Problem is with any datetime field. The JSON is always on point and so the database.
Any help is appreciate