Select Date and Time in 2 steps using Ionic DateTime: I want to use Ionic DateTime selecting date and time. The problem is that the picker with pickerFormat="DD MMMM YYYY HH:mm" gets plicated and too narrow, so I want to select date first and just after select the time. Any idea about how to do so?
Select Date and Time in 2 steps using Ionic DateTime: I want to use Ionic DateTime selecting date and time. The problem is that the picker with pickerFormat="DD MMMM YYYY HH:mm" gets plicated and too narrow, so I want to select date first and just after select the time. Any idea about how to do so?
Share Improve this question edited Mar 2, 2018 at 23:54 Melchia 24.4k23 gold badges108 silver badges129 bronze badges asked Mar 2, 2018 at 21:14 Rafael López MartínezRafael López Martínez 2,2652 gold badges17 silver badges25 bronze badges1 Answer
Reset to default 5You can always separate them like this
<ion-item [hidden]="!!myDate">
<ion-label>Date</ion-label>
<ion-datetime (ngModelChange)="change(datePicker)" displayFormat="MM/DD/YYYY" [(ngModel)]="myDate"></ion-datetime>
</ion-item>
<ion-item [hidden]="!myDate" >
<ion-label>Time</ion-label>
<ion-datetime #datePicker
(ionCancel)="myDate=undefined" displayFormat="HH:mm" [(ngModel)]="myTime"></ion-datetime>
</ion-item>
<h1 [hidden]="!myTime">result is {{myDate}} : {{myTime}} </h1>
then in ts
change(datePicker){
datePicker.open();
}
Then concatenate the results
this.dateTime= this.myDate + ":" + this.myTime;
Here's a DEMO
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744313795a4568079.html
评论列表(0条)