Moment.js / 日期范围选择器小时数转换不能提前超过 23 小时选择

Moment.js / Date Range picker hours conversion can't pick more than 23 hours ahead

当我从 AM/PM 更改为 24 时钟时,小时选择器只允许提前 23 小时。这是日期范围选择器的常见错误还是 moment.js 转换问题?

如果 moment.js 从我的服务器占用时间,我会上传我的照片吗?并且不能超过 23 小时...

另请参阅 codepen 和我的代码。

"setStartDate": [moment().startOf('day')],
"setEndDate": [moment()]

https://codepen.io/anon/pen/WMOmOO

注意format选项,必须使用有效的时刻标记,MM代表月,小写mm代表分钟,SS代表小数秒,使用小写字母 ss 作为秒数,参见时刻 docs 以获取进一步参考。

此外startDateendDateoptions接受日期对象,时刻对象或字符串,你传递的是一个数组,这就是为什么您收到无效日期。

这里是一个实时片段:

$('#demo').daterangepicker({
    "timePicker": true,
    "timePicker24Hour": true,
    "autoApply": true,
    "locale": {
        "format": "DD/MM/YYYY HH:mm:ss",
        "separator": " - ",
        "applyLabel": "Apply",
        "cancelLabel": "Cancel",
        "fromLabel": "From",
        "toLabel": "To",
        "customRangeLabel": "Custom",
        "weekLabel": "W",
        "daysOfWeek": [
            "Su",
            "Mo",
            "Tu",
            "We",
            "Th",
            "Fr",
            "Sa"
        ],
        "monthNames": [
            "January",
            "February",
            "March",
            "April",
            "May",
            "June",
            "July",
            "August",
            "September",
            "October",
            "November",
            "December"
        ],
        "firstDay": 1
    },
    "startDate": moment().startOf('day'),
    "endDate": moment()
}, function(start, end, label) {
  console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')");
});
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/bootstrap/3/css/bootstrap.css" />
 
<!-- Include Date Range Picker -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css" />

<input type="text" id="demo" style="width: 300px;"></input>