简体   繁体   English

禁用日期时间范围选择器中的所有日期

[英]Disable all dates in datetime range picker

I am using a datetime range picker as given here .我正在使用此处给出的日期时间范围选择器。 In some scenarios, I need only start-time and end-time dropdowns.在某些情况下,我只需要开始时间和结束时间下拉列表。 Is it possible to disable all dates shown in the calendar or hide the calendar?是否可以禁用日历中显示的所有日期或隐藏日历? I also want to remove the label displayed before the "Cancel" and "Apply" buttons.我还想删除“取消”和“应用”按钮之前显示的标签。 Does anyone know how to do this?有谁知道如何做到这一点?

在此处输入图片说明

I am using JQuery to hide the calendar but not sure whether this is the right way to do it.我正在使用 JQuery 来隐藏日历,但不确定这是否是正确的方法。

# Hide Calendar
$(".calendar-table").hide();

# Hide label that is displayed before "Cancel" and "Apply" buttons.
$(".drp-selected").hide();

According to official doc根据官方文档

autoApply: (true/false) Hide the apply and cancel buttons, and automatically apply a new date range as soon as two dates are clicked. autoApply: (true/false) 隐藏应用和取消按钮,并在点击两个日期后自动应用新的日期范围。

show.daterangepicker: Triggered when the picker is shown show.daterangepicker:显示选择器时触发

$('#daterangepicker').daterangepicker({
    "autoApply": true,
}).on('show.daterangepicker', function (ev, picker) {
    picker.container.find(".calendar-table").hide();
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Bootstrap日期范围选择器禁用日期 - Bootstrap Date Range Picker disable dates Ant Design 范围选择器禁用日期数组 - Ant Design range picker disable array of dates 使用引导程序日期时间选择器动态禁用特定日期 - Disable specific dates dynamically using bootstrap datetime picker 如何在剑道日期时间选择器中禁用时间范围 - How to disable range of time in Kendo datetime picker javascript Bootstrap日期时间选择器禁用小时数 - Bootstrap datetime picker disable hours 如何禁用日期范围? - How to disable range of dates? 日期时间选择器与期间范围jQuery - Datetime Picker with Period range jQuery 从ASP.Net中的背后代码禁用日期范围选择器中的自定义日期 - Disable custom dates in date range picker from code behind in ASP.Net 限制日期范围选择器中的选择日期并禁用其他日期 javascript 动态设置最大日期 - limit a select dates in date range picker and disable other days javascript Set maximum date dynamically 如何在日期选择器上禁用过去的日期。尝试了stackoverflow提供的所有解决方案 - How to disable the past dates on the date picker .Tried all solutions provided on stackoverflow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM