ionic 2 datetime display current date to future date and focused on today's date

Viewed 19619

I'm currently developing an app using ionic 2.

My problem is about datetime: I have this code in my html

  <ion-item>
    <ion-label stacked>Date</ion-label>
    <ion-datetime [(ngModel)]="date" formControlName="date" displayFormat="MMMM DD, YYYY" min="2017" max="2100"></ion-datetime>
  </ion-item>

The result is this => http://prntscr.com/fz5lx6

But I want to focus it to current date not to the maximum date.

How can I set that in ionic 2?

Any help is much appreciated. Thanks!

4 Answers

u can use this one too

currentDate: string = new Date().toLocaleDateString();

and it will look like this:

01/06/2018

I use the following format:

captura : any = new Date().toISOString();  
Related