Hi,
surveys.uc.pt/index.php/729839/lang-en
one holiday is 1/1/2015, partial translation from PT
I've made impossible to choose holidays also
-- João
Here is the code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$("button").click(function(){
// Identify this question
var thisQuestion = $('#question{QID}');
// The holidays - format: [month, date, description]
holidays = [
[1, 1, 'Dia de Ano Novo'], [2, 16, 'Family Day'], [4, 3, 'Sexta Feira Santa'],
[4, 5, 'Domingo de Páscoa'], [7, 1, 'Canada Day'], [9, 7, 'Labour Day'],
[10, 12, 'Thanksgiving'], [12, 25, 'Christmas'], [12, 26, 'Boxing Day']
];
// A function to show holidays and disable weekend days and holidays in a datepicker
function showHolidaysDisableWeekends(date) {
var thisMonth = date.getMonth();
var thisDate = date.getDate();
var thisDay = date.getDay();
var returnedArr = [true, '']; // Normal day
// Loop through the holidays
$(holidays).each(function(i, value) {
if (thisMonth == value[0] - 1 && thisDate == value[1]) {
if(thisDay == 0 || thisDay == 6) {
returnedArr = [false, 'holiday', value[2]+', Não é possível selecionar dias de fim de semana']; // Weekend holiday
}
else {
returnedArr = [false, 'holiday', value[2]+', Cannot choose holidays']; // Weekday holiday
}
return false; // Exit the loop
}
else if (thisDay == 0 || thisDay == 6) {
returnedArr = [false, '', 'Cannot choose a weekend day']; // Weekend day
}
});
return returnedArr;
}
// Apply the new "beforeShowDay" option
$('input[type="text"]', thisQuestion).datepicker('option', 'beforeShowDay', showHolidaysDisableWeekends).datepicker( "show" );
});
});
</script>