Skip to content

onProblem

Hears what the calendar could not do as asked — found while drawing, not in the data.

Type(problem: CalendarProblem) => void
Defaultnot set
Live update (update())Yes
Declared inpackages/dom/src/settings.ts

It receives { code, detail, element? } — detail in the calendar’s language (the messages bundle’s problem), code for programs:

  • events-not-drawn: events the view cannot show — all-day events in a time grid without its all-day row, timed events entirely outside slotMin–slotMax;
  • host-no-height: the calendar has no height of its own (an inline host, or --dz-height: 100% with no ancestor of a given height) and grows with its content;
  • zone-from-browser: no timeZone given, the device’s is used;
  • too-many-occurrences: a series has more than 2 000 occurrences in what is shown (a rule every minute, a year): the first 2 000 are drawn.

Each is told once per code, view and reason (a series for the last), and again if it comes back after going away. Without onProblem, each code is said once on the console. Bad data — an event that cannot be read — is not here: it is in calendar.kernel.getProblems() and onSource.

import { createCalendar } from '@dzcalendar/dom';
createCalendar(element, {
timeZone: 'Europe/Paris',
onProblem: (problem) => monitoring.report(`calendar ${problem.code}: ${problem.detail}`),
});
declare const monitoring: { report(message: string): void };

In the frameworks it is an output: Angular’s (problem), React’s onProblem, Vue’s @problem. Angular says them on the console too.