问题
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