beforeshowday 在日期时间选择器中不起作用

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

beforeshowday 选项在 datetimepicker 中不起作用我试过下面的代码。我尝试在 beforeshowday 函数中添加简单的警报,但它不起作用

$(document).ready(function(){
const current = new Date();
const prior = new Date().setDate(current.getDate() - 30);
var active_dates = ["03/02/2023","03/03/2023"];
$("#purchase_date").datetimepicker({
    format: 'mm/dd/yyyy hh:ii:ss',
    autoclose: true,
    todayBtn: true,
    todayHighlight: true,
    //startDate: new Date(prior),
    //endDate: '+0d',
    showOtherMonths: true,
    pickerPosition: "bottom-left",
    beforeShowDay: function(date){alert();
        var d = date;
        var curr_date = d.getDate();
        var curr_month = d.getMonth() + 1; //Months are zero based
        var curr_year = d.getFullYear();
        var formattedDate = curr_month + "/" + curr_date + "/" + curr_year

        if ($.inArray(formattedDate, active_dates) != -1){
           return {
              classes: 'activeClass'
           };
        }
        return;
    },
        
});
});     ```


i added code and it's not working
jquery jquery-ui datetimepicker
© www.soinside.com 2019 - 2024. All rights reserved.