Reputation: 131
So this is my html code, i would like to set the default date of the datepicker to today's date. How should i go about doing this?
<ion-item>
<ion-label floating>Date</ion-label>
<ion-datetime displayFormat="DD MMMM YYYY" pickerFormat="DD MMMM YYYY" [(ngModel)]="request.date" (Value)="myDate" ></ion-datetime>
</ion-item>
Upvotes: 2
Views: 1631
Reputation: 4099
Assign today's date value like this -
this.request.date = new Date().toJSON().split('T')[0];
Upvotes: 2