How to set the default date of ion-datetime is today Ionic-v2


#1

Thanks for reading! :blush:


#2

you can do something like this. initialize new date in your component then use binding.

 myDate: String = new Date().toISOString();

<button> today date <ion-datetime displayFormat="YYYY-MM-DD" [(ngModel)]="myDate" (ionChange) = "mydate(myDate)"> </ion-datetime></button>

 mydate(event){
    //do something here
  }

#3

thanks for your answer . But I have a question how to disable the days passed


#4

Well, you got that answered in the second topic you created on this problem:


#5