【问题标题】:AngularJS Bootstrap dateTime- picker date format dd.MM.yyyyAngularJS Bootstrap dateTime-picker 日期格式 dd.MM.yyyy
【发布时间】:2016-05-07 09:05:07
【问题描述】:

我使用这个 dateTime-Picker,但我遇到的问题是我无法在我的模型 iuc.scheduleAbsenceHeader.activationDate 中设置格式为 dd.MM.yyyy 的日期。如果我这样做,我会收到错误:

Datepicker 指令:“ng-model”值必须是 Date 对象、自 01.01.1970 以来的毫秒数或表示 RFC2822 或 ISO 8601 日期的字符串。

有谁知道我该如何解决这个问题?

<input type="text"
       class="form-control"
       name="systemEntryDate"                                
       ng-model="iuc.scheduleAbsenceHeader.activationDate"
       ng-change="vm.updateScheduleAbsenceHeader(iuc)"
       datepicker-popup="dd.MM.yyyy"
       is-open="iuc.scheduleAbsenceHeader.openedDatePicker"
       close-text="schlie&szlig;en"
       current-text="heute"
       clear-text="l&ouml;schen">
<span class="input-group-btn">
 <button type="button" class="btn btn-default"                                 
         ng-click="vm.openDatePickerSystemEntry($event, institutionUserConnection)"><span
         class="glyphicon glyphicon-calendar"></span></button>

【问题讨论】:

    标签: angularjs twitter-bootstrap


    【解决方案1】:

    使用 moment.js 我可以成功地将 dateTime 选择器的值设置为当前 dateTime,如下所示:

    vm.myDate = moment((moment().toISOString())).format("MM.DD.YYYY")
    

    否则,有一个look at this post。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-05
      • 1970-01-01
      • 1970-01-01
      • 2023-02-01
      • 1970-01-01
      • 2018-08-25
      • 2013-01-19
      • 1970-01-01
      相关资源
      最近更新 更多