Skip to content

store

An event store to share: several calendars on one store show the same events.

TypeEventStore
Defaultnot set
Live update (update())No — at creation only
Declared inpackages/core/src/kernel.ts

Every calendar keeps its events in a store. Given one made with createEventStore() (@dzcalendar/core), calendars share it: four calendars in four zones show the same events, each in its own hours; an event moved in one moves in all. Each calendar keeps the undo history of its own commands; one changed by another calendar meanwhile leaves that history (its entries could no longer be undone). Load the events once: each calendar’s events option is the same source in the shared store, the last one replacing the others.

Each calendar still has its own options — zone, view, sources. An event dragged from one calendar to another (droppable) is a different thing: two stores, the event leaving one.

It is read when the calendar is made.

import { createEventStore } from '@dzcalendar/core';
import { createCalendar } from '@dzcalendar/dom';
const store = createEventStore();
// The same events, in Paris and in Chicago.
const paris = createCalendar(document.getElementById('paris')!, { timeZone: 'Europe/Paris', store });
createCalendar(document.getElementById('chicago')!, { timeZone: 'America/Chicago', store });
paris.kernel.setEvents([{ id: 'call', title: 'Call', start: '2026-10-22T16:00[Europe/Paris]', duration: { hours: 1 } }]);

In Angular it goes in the defaults (DZ_CALENDAR_DEFAULTS, provideDzCalendar) — a component’s DZ_CALENDAR_DEFAULTS replaces the application’s for its calendars, so repeat what they need; in React and Vue, in initial.

  • kernel — a whole kernel made elsewhere.
  • events — the events a store is filled with.
  • timeZone — each calendar its own zone.