Hi,
I want to disable french public holidays in my datepicker. So, I used the following and it’s working. But, to avoid a manual modifying every year I want to disable these specific dates for every years coming. Does anyone know how to do it ?
To disable French public holidays from the datepicker, please use the following code, which will automatically disable them for all future years, eliminating the need for manual updates each year.
jQuery(document).ready(function ($) {
gform.addFilter("gform_datepicker_options_pre_init", function (optionsObj, formId, fieldId) {
// Update your form ID and field ID here
if (formId == 1 && fieldId == 24) {
optionsObj.beforeShowDay = function (date) {
var disabledDays = ["04/21", "05/01", "05/08", "05/29", "07/14", "08/15", "11/01", "11/11", "12/25"];
var checkdate = jQuery.datepicker.formatDate("mm/dd", date);
return [disabledDays.indexOf(checkdate) == -1];
};
}
return optionsObj;
});
});
Hi, thank you very much, it’s working.
But now I want disable french public holidays, weekends and also the 2 next day, so I did this (but it’s not working). Each thing is working separetly but not together (I do not know how to code jquery…)
<script>
gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, fieldId ) {
if ( formId == 1 && fieldId == 24 ) {
/** sauf week-end **/
optionsObj.firstDay = 1;
optionsObj.beforeShowDay = jQuery.datepicker.noWeekends;
/** sauf 2j avant **/
optionsObj.minDate = 2;
/** sauf jours feries **/
optionsObj.beforeShowDay = function (date) {
var disabledDays = ["04/21", "05/01", "05/08", "05/29", "07/14", "08/15", "11/01", "11/11", "12/25"];
var checkdate = jQuery.datepicker.formatDate("mm/dd", date);
return [disabledDays.indexOf(checkdate) == -1];
};
}
return optionsObj;
});
</script>```
Culd you help me please :)