I have successfully implemented a DatePicker in my Ionic Project, but the date is displaying in the wrong time format. Here is my function:
showDatePicker(){
this.datePicker.show({
date: new Date(),
mode: 'date',
allowOldDates: false,
androidTheme: this.datePicker.ANDROID_THEMES.THEME_HOLO_DARK
}).then(
date => this.selectedDate = date
);
this.changeAPI();
}
The output string currently looks like this:
Tue Jan 15 2019 00:00:00 GMT+0100 Central European Standard Time
However, I would like it to be displayed as follows:
15.01.2019
How can I achieve this formatting? I have tried using the following code:
this.selectedDate.toLocaleDateString('de-DE');
But unfortunately, it does not seem to work (I am implementing this in the TypeScript file rather than the HTML file).
Additionally, how can I hide dates in the DatePicker that occur before today?
Thank you for any assistance.