视图和模型之间的角度引导日期选择器不匹配 [英] angular bootstrap datepicker mismatch between view and model
本文介绍了视图和模型之间的角度引导日期选择器不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用角度引导时间选择器.我面临的问题是视图和模型之间不匹配.从示例中可以看到,我选择了2015-05-07,但模型落后了一天.
I'm using angular bootstrap timepicker. The problem I'm facing is that I have a mismatch between the view and the model. As you can see from the example, I chose 2015-05-07 but the model is a day behind.
<div dir="ltr" class="col-md-3 datePickerComponent">
<div>{{payments.user.start_dt}}</div>
<span dir="rtl" class="datePickerLabel">
תאריך התחלה
</span>
<p class="input-group">
<input ng-disabled="true" dir="rtl" ng-change="payments.GetPayments()" type="text" class="form-control" datepicker-popup="dd-MM-yyyy" ng-model="payments.user.start_dt" is-open="payments.opened_start" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="payments.open_start($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
</div>
推荐答案
将日期过滤器应用于视图中的值
Apply the date filter to the value in your view
<div>{{payments.user.start_dt | date : format : timezone}}</div>
例如
<div>{{payments.user.start_dt | date : longDate}}</div>
这篇关于视图和模型之间的角度引导日期选择器不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文