问题
Can you tell me how to start the date from the current date when the user tries to select the date from picker? I don't need to set the default date. Because this field is not a mandatory field. So can you tell me how to do that?
Here you can see the stackblitz project. Please see the home folder.
.ts
minDate = moment().format('YYYY');
maxDate = moment().add(3, 'y').format('YYYY');
completionDate: string;
.html
<ion-item>
<ion-label fixed>Completion Date</ion-label>
<ion-datetime displayFormat="D MMM, YYYY" [min]="minDate"
[max]="maxDate" [(ngModel)]="completionDate"></ion-datetime>
</ion-item>
UI
来源:https://stackoverflow.com/questions/46302766/date-selection-should-start-from-the-current-date