angularjs daterangepicker日历显示不正确的日期

问题描述 投票:0回答:1

我在我的angularjs应用程序中使用了angularjs-daterangepicker。从下图可以看出,日期显示有误。

   <button type="button"
       ng-click="$ctrl.DateRangeChanged()"
       date-range-picker="$ctrl.durationDateRange"
       ng-model="$ctrl.date"
       options="$ctrl.options" >Customize
   </button>

日期范围选项如下

this.options = {
  pickerClasses: 'custom-display', // angular-daterangepicker extra
  buttonClasses: 'btn',
  applyButtonClasses: 'btn-primary',
  cancelButtonClasses: 'btn-danger',
  locale: {
    applyLabel: 'Apply',
    cancelLabel: 'Cancel',
    customRangeLabel: 'Custom range',
    separator: ' - ',
    format: 'YYYY-MM-DD', // will give you 2017-01-06
    // format: "D-MMM-YY", // will give you 6-Jan-17
    // format: "D-MMMM-YY", //will give you 6-January-17
  },
  timePicker: true,
  autoApply: true,
  showDropdowns: true,
  startDate: (moment()).startOf('day'),
};

enter image description here

angularjs bootstrap-datetimepicker
1个回答
0
投票

您必须在输入中添加date-range-picker-options

<button type="button"
       ng-click="$ctrl.DateRangeChanged()"
       date-range-picker="$ctrl.durationDateRange"
       ng-model="$ctrl.date"
       date-range-picker-options="$ctrl.options" >Customize
   </button>
© www.soinside.com 2019 - 2024. All rights reserved.