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.

You will need to modify start_date and end_date to your chosen dates:

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);
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.