0
J'ai cette réponse de travail, mais je voudrais étendre: jQuery UI Datepicker - Disable specific daysjQueryUI Datepicker noWeekendsAndHolidaysAndWeekDay
Je suis bloqué sur l'ajout de cette méthode à la solution:
beforeShowDay: function(date){
var day = date.getDay();
return [(day != 5)];
}
à noWeekendsAndHolidays. Comment puis-je ajouter cela?
Ainsi, le datepicker option beforeShowDay aurait 3 retourne "faux":
- aucun week-end
- pas de vacances
- pas en semaine sélectionné («nous sommes fermés le vendredi, trop ")
code de travail avec les deux premières options (j'ai besoin d'aide avec le troisième):
$(document).ready(function(){
$("#datepicker").datepicker({
noWeekends: true,
numberOfMonths: 2,
beforeShowDay: noWeekendsOrHolidays,
minDate: '-1M -1W -1D',
maxDate: '+1M',
firstDay: 1
});
function nationalDays(date){
var natDays = [[7, 26, 'Shop-Closed']];
for (i = 0; i < natDays.length; i++) {
if (date.getMonth() == natDays[i][0] - 1 &&
date.getDate() == natDays[i][1]) {
return [false, natDays[i][2] + '_day'];
}
}
return [true, ''];
}
function noWeekendsOrHolidays(date){
var noWeekend = $.datepicker.noWeekends(date);
if (noWeekend[0]) {
return nationalDays(date);
}
else {
return noWeekend;
}
}
});
Merci d'avance.
Oui, exactement. Merci Simen. – orolo