DayPilot.Calendar.onBeforeEventRender

The onBeforeEventRender event is fired before the JavaScript Calendar renders an event. It lets you customize the event properties dynamically.

When setting custom HTML using args.data.html, make sure that all input values are properly escaped to prevent XSS attacks.

Declaration

DayPilot.Calendar.onBeforeEventRender(args);

Parameters

Example

Calendar config:

{
  onBeforeEventRender: (args) => {
    const text = DayPilot.Util.escapeHtml(args.data.text);
    const start = args.data.start.toString("h:mm tt");
    const end = args.data.end.toString("h:mm tt");
    args.data.html = `${text} (${start} - ${end})`;

    args.data.cssClass = "test";
  },
  // ...
}