Reputation: 305
I want to make an edit form and I need to set a default date in the ion-datetime.
The .html
<ion-datetime #fecha displayFormat="DD/MM/YYYY" [(ngModel)]="myVar" pickerFormat="DD MM YYYY" doneText="Ok" cancelText="Cancelar"></ion-datetime>
The .ts
public myVar = "15-06-1999";
Upvotes: 5
Views: 10971
Reputation: 845
myDate: String = new Date(yourdate).toISOString();
<ion-datetime displayFormat="MMM DD, h:mm A" [(ngModel)]="myDate"></ion-datetime>
Upvotes: 16