The clearSelection() method clears the current time range selection in the JavaScript Calendar component.
DayPilot.Calendar.clearSelection()The typical usage is to clear the selection in DayPilot.Calendar.onTimeRangeSelected(args) after processing the selected range.
const dp = new DayPilot.Calendar("dp", {
onTimeRangeSelected: async (args) => {
const modal = await DayPilot.Modal.prompt("New event name:", "Event");
dp.clearSelection();
if (modal.canceled) {
return;
}
dp.events.add({
start: args.start,
end: args.end,
id: DayPilot.guid(),
text: modal.result
});
},
// ...
});
dp.init();Time Range Selecting [doc.daypilot.org]