The onTimeRangeSelected event handler is fired by the monthly calendar component when a user selects a time range using drag and drop.
You can use it to create a new event.
This event is fired after the default action. In case on time range selection, there is no default action so it is an equivalent of onTimeRangeSelect event.
DayPilot.Month.onTimeRangeSelected(args)
args.start
(DayPilot.Date) - selection start
args.end
(DayPilot.Date) - selection end
// event creating
onTimeRangeSelected: (args) => {
var name = prompt("New event name:", "Event");
dp.clearSelection();
if (!name) return;
dp.events.add({
start: start,
end: end,
id: DayPilot.guid(),
text: "Event"
});
dp.message("Created");
}
See also DayPilot.Month.api.
onTimeRangeSelected(start, end, resource)
start (DayPilot.Date) - start of the selected range
end (DayPilot.Date) - end of the selected range
resource (string) - id of the resource