how to put the default date on the ion-datetime ionic date

0

I have a lot of problems with that ion-datetime date format. I just want to pass the date field that is in '2017-01-01 04:39:00' format to ion-datetime but I get format error. I have been looking for several hours how to solve this and nothing appears

    
asked by santiago 30.11.2017 в 21:21
source

1 answer

0

We declare the variable and in the constructor we match it

  myDate: any ;

  constructor(public navCtrl: NavController) {
    this.myDate = "2020-12-01";
  }

then in the html

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

Result

The problem is when you try a date like this

2020-12-01 03:25:00

that is, yyyy-MM-dd hh: mm: ss

I would think that the best option is to manage the date and time by standing

    
answered by 30.11.2017 / 22:44
source