Can't i disable dates before TODAY?


#1

How to disable dates before today and set default date as today ???


#2

For default date u can bind value in .ts to datetime ngModel.
Remember ionic ISO 8601 datetime format for its value

.html

<ion-item>
    <ion-label>Start Time</ion-label>
    <ion-datetime displayFormat="YYYY-MMM-DD" [(ngModel)]="today"></ion-datetime>
</ion-item>

.ts

today = new Date().toISOString();

#3

In addition to what @mobgg has explained, you can do the following:

In your component:

minDate: string = new Date().toISOString();
selectedDate: string = new Date().toISOString();

… and in the template:

<ion-datetime displayFormat="MM/DD/YYYY" [(ngModel)]="selectedDate" [min]="minDate"</ion-datetime>

Check out the Min and Max in the API docs: