Skip to content

titleFormat

How the header’s title is written: the platform’s date-format options, or a function.

TypeTitleFormat — DateTimeFormatOptions | ((arg: TitleFormatArg) => string)
Defaultthe month, a week's days, a day in full
Live update (update())Yes, as formats: update({ formats: … })
Declared inpackages/core/src/kernel.ts

By default the title is the month (October 2026), a week’s days (19 – 25 Oct 2026) or a day in full, in the calendar’s locale.

  • Options of Intl.DateTimeFormat ({ month: 'long', year: 'numeric' }): a range is written when the first and last days differ.
  • A function ({ start, end, view, locale }) => string: start and end are the first and last days shown (PlainDates), view is the view’s type.

titleFormat is read when the calendar is made. To change the title later, update({ formats: { title } }) takes the same values — formats.title wins over titleFormat when both are given.

import { createCalendar } from '@dzcalendar/dom';
const calendar = createCalendar(element, {
timeZone: 'Europe/Paris',
titleFormat: ({ start, view }) => (view === 'timeGridWeek' ? `Week of ${start.toLocaleString('en-GB', { day: 'numeric', month: 'long' })}` : start.toLocaleString('en-GB', { month: 'long', year: 'numeric' })),
});
// Later: the title in another way.
calendar.update({ formats: { title: { month: 'long', year: 'numeric' } } });

titleFormat is read once, when the calendar is made: in Angular through the defaults (DZ_CALENDAR_DEFAULTS, provideDzCalendar), in React and Vue through initial — or, live, formats: { title } in each.

The week’s title written by the application: the month in full and the year.