我想从 daterangepicker 禁用未来的几个小时,我试过了
"maxDate": moment().utc().startOf('hour'),
但这只会禁用未来的日期而不是小时。
另外,我如何禁用分钟下拉菜单或仅将其删除 daterangepicker 因为我只想保留小时下拉菜单。
下面是我正在使用的。
$('#demo').daterangepicker({
"showISOWeekNumbers": true,
"timePicker": true,
"showDropdowns": true,
"timePicker24Hour": true,
"autoUpdateInput": true,
"format" : 'HH:00',
"maxDate": moment().utc().startOf('hour'),
"dateLimit" : {
'days': 7
},
"maxSpan": {
"days": 7
},
"locale": {
"cancelLabel": 'Clear',
"format": "DD/MM/YYYY @ HH:00",
"separator": " - ",
"applyLabel": "Apply",
"cancelLabel": "Cancel",
"fromLabel": "Start",
"toLabel": "End",
"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
},
"linkedCalendars": true,
"startDate": 1
});
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/3/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="text" id="demo" name="datefilter" value="" />
<script type="text/javascript" src="//cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script>