Я использую плагин datapicker jQuery, и я использую функцию noWeekends для отключения выходных. Единственная проблема: мне нужно включить один выходной день. Кто-нибудь знает как это сделать? Вот код, который я использую...
var disabledDays = [<?php echo rtrim($daysClosed, ","); ?>];
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, disabledDays[i][2] + '_day'];
}
}
return [true, ''];
}
function noWeekendsOrHolidays(date) {
var noWeekend = jQuery.datepicker.noWeekends(date);
return noWeekend[0] ? nationalDays(date) : noWeekend;
jQuery('.cart-contents i').html(noWeekend);
}
jQuery(document).ready(function(){
jQuery('#e_deliverydate').datepicker({
dateFormat: 'dd/mm/yy',
beforeShowDay: noWeekendsOrHolidays,
minDate:<?php echo $delivMin; ?>,
maxDate:'<?php echo $oneYearOn; ?>'
});
});
Заранее спасибо :)
$("#datepicker").datepicker({
beforeShowDay: function (date) {
var day = date.getDay();
return [(day != 6)]; //0-Sunday 6-Saturday
}
});
Отключить все 28th Dec
var array = ["28-12"];
$("#datepicker").datepicker({
beforeShowDay: function (date) {
var string = jQuery.datepicker.formatDate('dd-mm', date);
return [array.indexOf(string) == -1]
}
});
28th Dec 2013
var array = ["28-12-2013"]; // add dates you want to disable here
$("#datepicker").datepicker({
beforeShowDay: function (date) {
var string = jQuery.datepicker.formatDate('dd-mm-yy', date);
return [array.indexOf(string) == -1]
}
});
28th Dec
$("#datepicker").datepicker({
beforeShowDay: function (date) {
var string = jQuery.datepicker.formatDate('dd-mm-yy', date);
if (string == "28-12-2013") {
return [true];
} else {
var day = date.getDay();
return [(day != 6)];
}
}
});
noWeekendsOrHolidays
которая отключает все выходные и любые дни, которые я определяю. Я должен был объяснить, что я не хочу включать все субботы, только один день - 28 декабря. Спасибо