Skip to content

onCommandRefused

Hears a change the calendar’s own interface asked for refused — and why.

Type(result: CommandResult, command: Command) => void
Defaultnot set
Live update (update())Yes
Declared inpackages/dom/src/settings.ts

A deletion (from the menu or the Delete key), the scope chosen for an occurrence, a gesture or a drop whose command is refused after it was shown valid — each is a command checked against the rules; when one is refused, this option receives the result and the command: result.problems (each { code, severity, path, detail }) and result.violations (constraint, overlap, allow, valid-range, not-editable, each with its eventId). Say it to the person — nothing changed. A gesture let go where the rules refuse it is said by onProposalRefused instead; your own calendar.run() returns its result to you directly.

import { createCalendar } from '@dzcalendar/dom';
createCalendar(element, {
timeZone: 'Europe/Paris',
editable: true,
rules: { overlap: false },
onCommandRefused: (result, command) => {
if (!result.ok) console.warn(command.type, 'refused:', result.violations?.map((v) => v.code), result.problems);
},
});

In Angular and Vue it goes in options; in React it is a prop.