Articles on: FAQ's

How to Restrict an Appointment Calendar to Specific Dates

How to Restrict an Appointment Calendar to Specific Dates



To restrict an appointment calendar to specific dates, you can add the following code in the Custom Script Tag section of the form.




var calendar_check = setInterval(function(){
    var start_date = '2023-05-08';
    var end_date = '2023-05-10';
  	if (AD && AD.jQuery && AD.jQuery('%FORM.HTML_ID% div.appointment-calendar').data('datepicker')) {
       var datepicker = AD.jQuery('%FORM.HTML_ID% div.appointment-calendar').data('datepicker');
       datepicker._process_options({startDate: start_date, endDate: end_date});
       datepicker.setDate(start_date);                                                                            
       AD.jQuery('%FORM.HTML_ID% div.appointment-calendar').trigger('jd:ajax-update', [new Date(start_date)]);
       clearInterval(calendar_check);
    }
  },200);

Updated on: 27/06/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!