Reputation: 23
I would like my calendar to only allow the user to create new events during business hours. The catch is that the business hours are not the same each week, they depend on the date. My table with the business hours looks like this:
+-----+-----------+----------+------------+------------+
| day | startTime | endTime | firstDate | lastDate |
+-----+-----------+----------+------------+------------+
| 6 | 08:00:00 | 12:30:00 | 2021-12-20 | NULL |
| 6 | 13:00:00 | 16:30:00 | 2021-12-20 | NULL |
| 2 | 08:00:00 | 17:00:00 | 2021-12-27 | 2021-12-27 |
| 4 | 08:00:00 | 17:00:00 | 2021-12-29 | 2021-12-29 |
+-----+-----------+----------+------------+------------+
The business hours in FullCalendar don't have an option to specify validity periods.
I have been looking at using background events but don't quite understand how to achieve the desired result that way.
How can I limit new events to specific times for each day of the week where these times vary each week?
Upvotes: 1
Views: 419
Reputation: 23
This gets us recurring background events:
{
startTime: '08:00:00',
endTime: '12:30:00',
daysOfWeek: '6',
startRecur: '2021-12-20',
rendering: 'background',
groupId: 1
},
{
startTime: '13:00:00',
endTime: '16:30:00',
daysOfWeek: '6',
startRecur: '2021-12-20',
rendering: 'background',
groupId: 1
}
For more information on recurring events see https://fullcalendar.io/docs/recurring-events
Upvotes: 1