Get full-time working hours when resizing

I implemented a complete calendar to support some events. Now the full calendar is implemented with some default business hours. Suppose I set the working time from 10:00 to 17:00. Now I am creating an event from 15:30 to 16:30. Now, when I resize the event and stretch it, and until 17:30, which does not work, I want it to roll back the changes.

This is how I initialized fullcalendar:

$('#calendar').fullCalendar({ header: { left: '', center: '', right: '', }, firstDay: 0, editable: true, selectable: true, defaultView: 'agendaWeek', columnFormat: 'dddd', events: events_data, eventResize: function(event, delta, revertFunc) { console.log($(this).businessHours); } }); 

Please let me know if something else is needed. Any help would be appreciated. Thanks in advance.

+8
javascript jquery fullcalendar
source share
1 answer

In your eventResize function eventResize you can check the event parameter and check the input.

 function isBusinessHour(event) { // Check if your event.start and event.end is in business hours // Using moment functions such as isBetween() } eventResize: function(event, delta, revertFunc) { if (!isBusinessHour(event)) revertFunc(); } 
+1
source share

All Articles