I’m using the event calendar in a booking system that allows people to select a date for their appointment, but I need to prevent them from picking days prior to today.
I looked at this page in the demo but it doesn’t explain how to do what I’m looking for.
JQuery and JQuery Mobile Event calendar Manage blocked out dates Example | Mobiscroll
This is what I have currently:
$.get("get-staffschedule.json.php?staffid=<?=$groomer?>", function(data){
var calendar = $('#availabilitycalendar').mobiscroll5().eventcalendar({
display: 'inline',
invalid: [<?=$invalidstring?>],
theme: 'material',
themeVariant: 'light',
responsive: {
xsmall: {
view: {
calendar: {type: 'week'}
}
},
small: {
view: {
calendar: {type: 'week'}
}
}
},
onSelectedDateChange: function (event, inst) {
loadDetail(event);
}
}).mobiscroll5('getInst');
calendar.setEvents(JSON.parse(data));
});
loadDetail(null,'<?=$today?>');
As you can see I’m passing in $invalidstring which I generate on the server side to block out days that the business is closed or the staff is not scheduled to work, but all these invalid dates have both a start date and an end date. So I thought maybe I can pass in an invalid string with only an end date, so it would assume it includes every prior to that end date, but that didn’t work.
"{end: new Date(),allDay: true},"
So how can I accomplish this? What can I pass into that invalid string to block of all days prior to today?