以下是日期选择器代码。此处周日和周六被禁用。我尝试了很多来启用周日。要进行哪些更改以仅将周日启用为工作日。
<script>
(function ($) {
var disabledDays = ["5-28-2012","7-4-2012","7-5-2012","7-6-2012","9-3-2012","9-17-2012","9-26-2012","11-22-2012","11-23-2012","12-25-2012","1-1-2013"];
function nationalDays(date) {
var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
for (i = 0; i < disabledDays.length; i++) {
if($.inArray((m+1) + '-' + d + '-' + y,disabledDays) != -1) {
return [false];
}
}
return [true];
}
function noWeekendsOrHolidays(date) {
var noWeekend = jQuery.datepicker.noWeekends(date);
return noWeekend[0] ? nationalDays(date) : noWeekend;
}
var fourWorkingDays = new Date();
var adjustments = [0, 0, 2, 2, 2, 2, 1];
fourWorkingDays.setDate(fourWorkingDays.getDate() + 1 + adjustments[fourWorkingDays.getDay()]);
jQuery(document).ready(function() {
jQuery('#cf3_field_10').datepicker({
minDate: 0,
//maxDate: new Date(2011, 11, 31),
dateFormat: 'DD, MM, d, yy',
constrainInput: true,
beforeShowDay: noWeekendsOrHolidays
});
jQuery('#cf3_field_11').timepicker({
showPeriod: true,
onHourShow: OnHourShowCallback,
onMinuteShow: OnMinuteShowCallback
});
function OnHourShowCallback(hour) {
if ((hour > 18) || (hour < 9)) {
return false; // not valid
}
return true; // valid
}
function OnMinuteShowCallback(hour, minute) {
if ((hour == 18) && (minute >= 0)) { return false; } // not valid
if ((hour == 9) && (minute < 30)) { return false; } // not valid
return true; // valid
}
});
})(jQuery);
</script>
我只想启用星期天作为已经禁用的工作日检查www.jbediamonds.com/form.php,日期部分