The getSelection() method returns the current time range selection.
DayPilot.Calendar.getSelection()Returns a DayPilot.Selection object with the following properties:
start (DayPilot.Date) - selection start
end (DayPilot.Date) - selection end
resource (string) - resource ID if specified for the column; otherwise null
If no range is selected, it returns null.
const calendar = new DayPilot.Calendar("dp", {
// ... config
});
calendar.init();
const selection = calendar.getSelection();