选择禁用日期时提醒用户

时间:2015-10-31 13:18:49

标签: jquery datepicker

当用户从jQuery日期选择器中单击禁用日期时,如何提醒用户日期不可用?

使用Date Picker插件

$(function() {
    // $( "#datepicker" ).datepicker();
    var array = ["2015-12-06", "2015-12-18", "2015-12-19", "2016-04-01", "2016-05-14", "2017-09-16", "2017-08-12", "2016-10-22",
        "2016-10-15", "2016-09-17", "2016-09-10", "2016-09-03", "2016-08-20", "2016-08-13", "2016-07-23",
        "2016-07-16", "2016-07-01", "2016-06-18", "2016-06-11", "2016-06-04", "2015-10-31"
    ];
    var dateToday = new Date();

    $('#packagedatepicker').datetimepicker({
        timepicker: false,
        minDate: dateToday,
        format: 'Y-m-d',
        beforeShowDay: function(date) {
            var day = date.getDay();
            //return [(day != 1 && day != 2 && day != 3 && day != 4)];

            var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
            return [(array.indexOf(string) == -1 && day != 1 && day != 2 && day != 3 && day != 4)]
        }
    });
});

0 个答案:

没有答案