admin管理员组文章数量:1405554
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
本文标签: javascriptSelect Date and Time in 2 steps using Ionic DateTimeStack Overflow
版权声明:本文标题:javascript - Select Date and Time in 2 steps using Ionic DateTime - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744313795a2600160.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论