Please help us help you and fill where relevant:
Your LimeSurvey version:
5.6.44+231107
Own server or LimeSurvey hosting: own server
Survey theme/template: modified vanilla
==================
A few years ago I found some code (see below) here that helped me set up a Date/Time question that only allows certain dates to be selected (every Wed except certain holidays). For the most part, it works. I also use Expression Manager to set the Minimum Date to 2 weeks out [date("Y-m-d", strtotime("today") + 14 * 60 * 60 * 24)]. The problem is that when the Minimum Date falls on a day that is blocked by the code, it automatically gets filled in and can be submitted. If you click on the calendar icon, the date is blocked and can't be selected. But if you leave it as is, it is accepted. This form is for setting up a date to write an exam and the earliest date should be 2 Weds in the future. We have Dec 27th blocked off as a holiday, but today it gets automagically filled in as the Minimum Date (14 days out). How can I make these 2 things work together?
JavaScript code in the question:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
// Disable days of week except Wed
$('#answer{SGQ}_datetimepicker').data('DateTimePicker').daysOfWeekDisabled([0,1,2,4,5,6]);
// Disable holidays
var holidays = ; // Variable holidays
var futureYears = 1; // Number of years to handle future fixed holidays
var thisYear = new Date().getFullYear();
for (i = 0; i < (futureYears+1); i++) {
holidays.push('01-01-'+(thisYear+i)); // New Years Day
holidays.push('01-07-'+(thisYear+i)); // Canada Day
holidays.push('11-11-'+(thisYear+i)); // Remembrance Day
holidays.push('24-12-'+(thisYear+i)); // Christmas Eve Day
holidays.push('25-12-'+(thisYear+i)); // Christmas Day
holidays.push('26-12-'+(thisYear+i)); // Boxing Day
holidays.push('27-12-'+(thisYear+i)); // University Holiday
holidays.push('28-12-'+(thisYear+i)); // University Holiday
holidays.push('29-12-'+(thisYear+i)); // University Holiday
holidays.push('30-12-'+(thisYear+i)); // University Holiday
holidays.push('31-12-'+(thisYear+i)); // University Holiday
holidays.push('20-12-'+(thisYear+i)); // No OA Exams
holidays.push('21-12-'+(thisYear+i)); // No OA Exams
holidays.push('22-12-'+(thisYear+i)); // No OA Exams
holidays.push('23-12-'+(thisYear+i)); // No OA Exams
holidays.push('02-01-'+(thisYear+i)); // No OA Exams
holidays.push('03-01-'+(thisYear+i)); // No OA Exams
holidays.push('04-01-'+(thisYear+i)); // No OA Exams
holidays.push('05-01-'+(thisYear+i)); // No OA Exams
holidays.push('06-01-'+(thisYear+i)); // No OA Exams
holidays.push('07-01-'+(thisYear+i)); // No OA Exams
}
$('#answer{SGQ}_datetimepicker').data('DateTimePicker').disabledDates(holidays);
let str = document.getElementById("vmsg_81122_value_range").innerHTML;
let res = str.replace(/Answer must be greater or equal to/g, "You must select the first available date <em>after</em>");
document.getElementById("vmsg_81122_value_range").innerHTML = res;
});
</script>