Disable Dates in UI Date Picker from Array

与世无争的帅哥 提交于 2019-12-11 17:14:36

问题


I have asked similar questions before but I am stuck on something and wondered if you could help, I am writing a function to disable dates in my UI-Datepicker and these dates are in an array. The dates are being populated from a SQL Server table , then placed in an array and now I want these dates to be disabled. I am still relatively new to programming, I hope this question hasn't been asked before.

My current code:

var connection = new ActiveXObject("ADODB.Connection") ;

var connectionstring="Data Source=;Initial Catalog=;User ID=;Password=;Provider=SQLOLEDB";

connection.Open(connectionstring);
var rs = new ActiveXObject("ADODB.Recordset");
var count === 0;
var BankHolidays;

rs.Open("SELECT * FROM CompanyBankHolidays", connection);
rs.MoveFirst;
while(!rs.eof) {
    count = count + 1;
    BankHolidays[count] = (rs.fields(1));
    rs.movenext;
}

rs.close;
connection.close;

function IsBankHoliday(date) {
    ///HELP HERE PLEASE//
}

$(function () {
    $(".startdate").datepicker({
    minDate: ('+1d'),
    changeMonth: true,
    dateFormat: 'dd/mm/yy',
    beforeShowDay: function (date) {
        return [(!IsChristmas(date) && !IsNewYearsDay(date) && !IsWeekend(date))];
        },
        onClose: function (selectedDate) {
            $(".enddate").datepicker("option", "minDate", selectedDate);
        }
    });
});

$(function () {
    $(".enddate").datepicker({
    minDate: ('+1d'),
    dateFormat: 'dd/mm/yy',
    beforeShowDay: function (date) {
        return [(!IsChristmas(date) && !IsNewYearsDay(date) && !IsWeekend(date))];
        },
        onClose: function (selectedDate) {
            $(".startdate").datepicker("option", "maxDate", selectedDate);
        }
    });
});

来源:https://stackoverflow.com/questions/23681344/disable-dates-in-ui-date-picker-from-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!