Skip to main content

update-event

Updates an existing event in the store. For events expanded from a recurrence rule, rawId selects the whole series or one occurrence, and mode selects single-occurrence versus this-and-following behavior.

Usage

type UpdateEventPayload = {
id: EventID;
rawId?: EventID;
event: Partial<CalendarEvent>;
mode?: "single" | "following";
};
FieldTypeDescription
idstring | numberCanonical stored event id; the update target.
rawIdstring | numberRendered occurrence identifier. A canonical rawId with no occurrence suffix edits the master; a suffixed one (e.g. "7###2026-03-09") edits that occurrence. For an ordinary event, rawId === id.
eventPartial<CalendarEvent>Fields to update; merged into the stored event.
mode"single" | "following"For occurrence-level recurring edits: "single" affects one occurrence, "following" this one and later ones. Omitting it defaults to "single" at the store.

The occurrence date is decoded from rawId — there is no separate originalDate field on the public payload.

For recurring events the store branches on rawId:

  • A canonical rawId edits the master, so every future expansion reflects the change. Adding an rrule to a one-off event here normalizes its duration and range envelope; clearing a master's rrule turns it back into a one-off and cascades delete-event calls to its exceptions.
  • A suffixed rawId edits one occurrence: mode: "single" writes an exception for that date, mode: "following" splits the series at it. After an occurrence update of the selected event, the action re-dispatches select-event for the resulting exception or new master (its canonical id as both id and rawId), so later auto-saves edit that record directly.

See Recurring events for the full model.

Trigger

// Whole-series edit: canonical rawId
api.exec("update-event", {
id: 7,
event: { text: "Renamed" },
});

// Single occurrence: suffixed rawId plus mode
api.exec("update-event", {
id: 7,
rawId: "7###2026-03-09",
mode: "single",
event: { text: "Just this one" },
});

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)"
/>