在日历设置选定的日期为NULL,引导日期时间选择器

问题描述 投票:-1回答:2

我使用的是引导日期时间选择器,文档这些都可以在这里找到:https://eonasdan.github.io/bootstrap-datetimepicker/Options/

我试图设置选定的日期为null。我能空出输入字段中的日期(即2019年2月10日),但是当我点击输入字段和日历打开,旧日期以蓝色仍处于选中状态。 WiThis是我的代码以取消选择在日历中的所有日期。

 $(document).ready(function() {

    $('.removedate').on('click', function(){

       $("#id_booking_date").val('') //this correctly removes date from input field

       $('.input-group').datetimepicker({
            date: new Date(null)
        });

}); 

此代码不能正常工作。你知道我应该尝试一下呢?

谢谢!

javascript bootstrap-datetimepicker
2个回答
-1
投票

可否请您尝试使用此“useCurrent”选项?看看这里https://eonasdan.github.io/bootstrap-datetimepicker/Options/#usecurrent


-1
投票

请试试这个,他们都明确提到here

工作示例:

$('#datetimepicker4').datetimepicker({ 

       useCurrent: false,//  
 });
© www.soinside.com 2019 - 2024. All rights reserved.