Skip to main content

update-event

Updates an existing event in the store. For events expanded from a recurrence rule, mode controls whether the edit applies to one occurrence or to that occurrence and every later one.

Usage

type UpdateEventPayload = {
id: EventID;
event: Partial<CalendarEvent>;
mode?: "single" | "following";
originalDate?: string;
};
FieldTypeDescription
idstring | numberTarget event id.
eventPartial<CalendarEvent>Fields to update; merged into the stored event.
mode"single" | "following"For recurring events: "single" affects one occurrence, "following" this one and later ones.
originalDatestringOriginal occurrence date for recurring edits, used to identify the affected instance.

Trigger

api.exec("update-event", {
id: 7,
event: { text: "Renamed" },
});

Observe

api.on("update-event", p => console.log("updated", p.id, p.event));

Intercept

api.intercept("update-event", p => p.event.text !== "");

Returning false cancels the update before it reaches the store.

Component handler

<Calendar
events={[]}
date={new Date()}
onupdateevent={p => console.log(p.id, p.event, p.mode)}
/>