Date selection should start from the current date

半腔热情 提交于 2019-12-13 03:55:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!