You can do it in the onEventMove event handler using the events.forRange() method:
onEventMove: args => {
const movedEvent = args.e;
const newStart = args.newStart;
const newEnd = args.newEnd;
const overlappingEvents = calendar.events.forRange(newStart, newEnd).filter(event => {
return event.id() !== movedEvent.id();
});
const hasOverlap = overlappingEvents.length > 0;
if (hasOverlap) {
args.preventDefault();
// Additional actions (e.g., user notification) can be added here
}
}
The events.forRange()
method is available in the open-source version since 2024.4.609.
The onEventMoving event is only available in the Pro version.
[updated]