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;
};
| Field | Type | Description |
|---|---|---|
id | string | number | Target event id. |
event | Partial<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. |
originalDate | string | Original 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)}
/>
Related articles
add-event— counterpart that creates events.delete-event— remove instead of update.select-event— open the editor that auto-saves throughupdate-event.- Recurring events —
modeandoriginalDatesemantics. - Persisting changes — forward updates to a backend.