I am using a calendar in my Ionic app that retrieves events from a database through an API.
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://portalemme2.com.br/SaoJoseAPI/agenda', true);
this.http.get('http://portalemme2.com.br/SaoJoseAPI/agenda').map(res => res.json()).subscribe(vetor => {
this.eventos = vetor.eventos;
});
Is there a way to change the date format so it can be displayed correctly on the calendar?
Currently, each event has a date in the format '2018-01-01' and an hour like '01:00:00.0000000' (from the database).
However, the Ionic calendar only accepts dates in the format '2017-12-16 01:00:00'.
I need to convert all the dates before pushing them into the "this.eventos" array.