Reputation: 133
I'm trying to limit user selection from a range between two dates but I didn't manage to make it work. I only managed to do it routinely like how it's specified at the businessHours documentation. Is there a way to make this work?
calendar = new FullCalendar.Calendar(calendarEl, {
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
initialView: 'timeGridWeek',
selectable: true,
selectMirror: true,
placeholder: true,
selectAllow:{
start: '2022-10-24',
end: '2022-10-25',
},
});
calendar.render();
Upvotes: 0
Views: 1103
Reputation: 133
As ADyson pointed out, I wasn't using the correct option. "selectConstraint" did the job for me, I already had tried it but I did send the dates as Strings, not as Dates objects.
calendar = new FullCalendar.Calendar(calendarEl, {
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
initialView: 'timeGridWeek',
selectable: true,
selectMirror: true,
placeholder: true,
//this worked!
selectConstraint:{
start: Date.parse('2022-10-26T00:00:00'),
end: Date.parse('2022-10-28T24:00:00')
},
});
calendar.render();
Upvotes: 1