Hi,
I am using ionic 2 and would like to set a date format value to displayFormat attribute of ion-datetime dynamically as this application can let the user to choose the format of date.
This is part of edit.ts
this.storage.get('date_format').then((date_format) => {
this.date_format = date_format;
});
Below is part of edit.html, but the format is Dec 12, 2015, even though date_format is “YYYY/MM/DD”.
<ion-datetime [displayFormat]="date_format" formControlName="base_date"></ion-datetime>
<p>{{ date_format }}</p> <- this shows YYYY/MM/DD
Tried below, but the format is still Dec 12, 2015.
<ion-datetime displayFormat="{{ date_format }}" formControlName="base_date"></ion-datetime>
How to set the value for displayFormat dynamically?
Thanks in advance