Highlighting Current Time using a Dynamic Indicator in JavaScript Calendar

You can use the showCurrentTime property to display a line indicating the current time position. 

  • The position is updated dynamically as the time changes.

  • The current time indicator is marked with *_now CSS class.

  • The indicator is turned off by default.

Another option to show the current time is to highlight the current calendar cell using the onBeforeCellRender event handler.

JavaScript

Show current time indicator:

{
  showCurrentTime: true,
  // ...
|

Highlight a cell using onBeforeCellRender:

{
  onBeforeCellRender: (args) => {
    const now = DayPilot.Date.now();
    if (args.cell.start <= now && now < args.cell.end) {
        args.cell.backColor = "red";
    }
  },
  // ....
}