Skip to content

views

Views of your own — three days, two weeks, a conference’s dates — beside the built-in ones.

TypeReadonly<Record<string, ViewSpec | ViewSettings>>
Defaultnot set
Live update (update())No — at creation only
Declared inpackages/core/src/kernel.ts

Each key is a view’s type (the name initialView, headerViews and update({ view }) use); each value is either settings — a family and what differs from a plain view — or a whole view spec. A key equal to a built-in name overrides it.

  • family: 'timeGrid', 'dayGrid', 'list', 'multiMonth', or the Pro’s 'timeline'.
  • duration and alignment ('day', 'week', 'month', 'year', 'none'): how long a period is and where it starts.
  • dateIncrement: how far previous / next move; dayCount: how many shown days (hidden days skipped).
  • visibleRange: a fixed period, whatever the date.
  • hiddenDays: the view’s own hidden weekdays.

Settings are checked when the calendar is made: a duration of nothing, a day count below 1 or a range that ends before it starts throws a RangeError. The view’s button label comes from messages.views.

import { createCalendar } from '@dzcalendar/dom';
const calendar = createCalendar(element, {
timeZone: 'Europe/Paris',
initialView: 'threeDays',
headerViews: ['threeDays', 'fortnight', 'timeGridWeek'],
views: {
// Three days from the date shown; previous / next move by three.
threeDays: { family: 'timeGrid', duration: { days: 3 } },
// Two weeks from the week's first day, moving one week at a time.
fortnight: { family: 'dayGrid', duration: { weeks: 2 }, alignment: 'week', dateIncrement: { weeks: 1 } },
},
messages: { views: { threeDays: '3 days', fortnight: 'Fortnight' } },
});

views is read once, when the calendar is made. In Angular it goes in the defaults (provideDzCalendar({ views }) for the application, DZ_CALENDAR_DEFAULTS for a component); in React and Vue, in initial.

Two views of your own in the header: three days at a time, and two weeks.