Holidays in EJ2 TypeScript Gantt control

2 May 20233 minutes to read

Non-working days in a project can be displayed in the Gantt control using the holidays property. Each holiday can be defined with the following properties:

  • from: Defines start date of the holiday(s).
  • to: Defines end date of the holiday(s).
  • label: Defines the description or label for the holiday.
  • cssClass: Formats the holidays label in the Gantt chart.

To highlight the holidays, inject the DayMarkers module into the Gantt control.

The following code example shows how to display the non-working days in the Gantt control.

import { Gantt, DayMarkers } from '@syncfusion/ej2-gantt';
import { GanttData } from 'datasource.ts';


let gantt: Gantt = new Gantt({
    dataSource: GanttData,
    height: '450px',
    taskFields: {
        id: 'TaskID',
        name: 'TaskName',
        startDate: 'StartDate',
        duration: 'Duration',
        progress: 'Progress',
        child: 'subtasks'
    holidays: [{
        from: "04/04/2019",
        to: "04/05/2019",
        label: " Public holidays",
        cssClass: "e-custom-holiday"

        from: "04/12/2019",
        to: "04/12/2019",
        label: " Public holiday",
        cssClass: "e-custom-holiday"

<!DOCTYPE html>
<html lang="en">

    <title>EJ2 Gantt</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript Gantt Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
	<link href="" rel="stylesheet" type="text/css"/>
    <script src=""></script>
    <script src="systemjs.config.js"></script>
	.e-gantt .e-gantt-chart .e-custom-holiday {
<script src="" type ="text/javascript"></script>

    <div id='loader'>Loading....</div>
    <div id="container">
        <div id="Gantt"></div>