The onBeforeTimeHeaderRender event handler lets you customize time headers in the JavaScript Calendar component.

Declaration

DayPilot.Calendar.onBeforeTimeHeaderRender(args)

Parameters

  • args.header.level (number, read-only) - zero-based time-header level
  • args.header.groupBy (string, read-only) - grouping for an explicit header level
  • args.header.date (DayPilot.Date or null, read-only) - full start date/time for explicit grouped headers and Resources; null for default time headers in Day and Week views
  • args.header.end (DayPilot.Date, read-only) - interval end
  • args.header.cssClass (string) - optional CSS class
  • args.header.backColor, args.header.fontColor (string) - optional colors
  • args.header.horizontalAlignment - "left", "center" or "right"
  • args.header.verticalAlignment - "top", "center" or "bottom"
  • args.header.areas - active areas displayed in the time header
  • args.header.hours (number) - hour part of the header time (read-only)
  • args.header.html (string) - HTML displayed in the time header
  • args.header.minutes (number) - minute part of the header time (read-only)
  • args.header.start (string) - header time as text, for example "13:30" (read-only)
  • args.header.text (string) - plain text used during Calendar image export (available since 2022.3.5376)
  • args.header.time (DayPilot.Duration) - header time value (read-only, available since 2018.4.3474)

Grouped headers and the additional level/group/end/style fields are supported from 2026.4.7150. Default time headers use a single column. See timeHeaders for level configuration.

These examples customize the default time headers by replacing the noon label. They configure an existing Calendar; retain its other settings.

JavaScript

const calendar = new DayPilot.Calendar("dp", {
  onBeforeTimeHeaderRender: args => {
    if (args.header.hours === 12) {
      args.header.html = "noon";
      args.header.text = "noon";
    }
  }
});
calendar.init();

Angular

<daypilot-calendar [config]="config"></daypilot-calendar>
import {DayPilot} from "daypilot-pro-angular";

config: DayPilot.CalendarConfig = {
  onBeforeTimeHeaderRender: args => {
    if (args.header.hours === 12) {
      args.header.html = "noon";
      args.header.text = "noon";
    }
  }
};

React

import {DayPilot, DayPilotCalendar} from "daypilot-pro-react";

<DayPilotCalendar
  onBeforeTimeHeaderRender={args => {
    if (args.header.hours === 12) {
      args.header.html = "noon";
      args.header.text = "noon";
    }
  }}
/>

Vue

<script setup lang="ts">
import {DayPilot, DayPilotCalendar} from "daypilot-pro-vue";
const onBeforeTimeHeaderRender: NonNullable<DayPilot.CalendarConfig["onBeforeTimeHeaderRender"]> = args => {
    if (args.header.hours === 12) {
      args.header.html = "noon";
      args.header.text = "noon";
    }
  };
</script>

<template>
  <DayPilotCalendar
    :onBeforeTimeHeaderRender="onBeforeTimeHeaderRender"
  />
</template>

See Also

Time Header Customization ยท Grouped Time Headers

Availability

Availability of this API item in DayPilot editions:

ProductLitePro
DayPilot for JavaScript