onProblem
Hears what the calendar could not do as asked — found while drawing, not in the data.
| Type | (problem: CalendarProblem) => void |
|---|---|
| Default | not set |
Live update (update()) | Yes |
| Declared in | packages/dom/src/settings.ts |
What it does
Section titled “What it does”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 outsideslotMin–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: notimeZonegiven, 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.
Example
Section titled “Example”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 };import { Component } from '@angular/core';import type { CalendarProblem } from '@dzcalendar/dom';import { DZ_CALENDAR } from '@dzcalendar/angular';
@Component({ selector: 'app-agenda', imports: [DZ_CALENDAR], template: `<dz-calendar timeZone="Europe/Paris" (problem)="said($event)" />`,})export class Agenda { said(problem: CalendarProblem): void { console.warn(problem.code, problem.detail); }}import { DzCalendar } from '@dzcalendar/react';
export function Agenda() { return <DzCalendar timeZone="Europe/Paris" onProblem={(problem) => console.warn(problem.code, problem.detail)} />;}<script setup lang="ts">import type { CalendarProblem } from '@dzcalendar/dom';import { DzCalendar } from '@dzcalendar/vue';
const said = (problem: CalendarProblem) => console.warn(problem.code, problem.detail);</script>
<template> <DzCalendar time-zone="Europe/Paris" @problem="said" /></template>In the frameworks it is an output: Angular’s (problem), React’s onProblem, Vue’s @problem. Angular says them on the console too.
See also
Section titled “See also”onSource— the data’s problems.timeZone— zone-from-browser.allDaySlot— events-not-drawn.