nonworkingDays colored in gray determine which days of the week are nonworking. Nonwokring days are ignored. This means that dropping a task in a nonworking day will add/remove slack time to it in order to recalculate the start/end date to a working date. Weekends are always colored in light blue.
https://www.jqwidgets.com/

jQuery Gantt: Nonworking days

JavaScript Gantt with non working days.

A live JavaScript/jQuery example of jqxGantt, the jQWidgets Gantt component, with its complete source code below. It is one of 15 jqxGantt demos for jQuery.

jqxGantt API used in this demo

Source code

To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $.

The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxgantt.js, jqxgantt.api.js.

It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).

script.js

window.onload = () => {
     const gantt = new jqxGantt("#gantt", {
         height: 'auto',
         view: 'week',
         nonworkingHours: [0, 1],
         source: [{
             label: 'Project 1',
             dateStart: '2026-02-14T12:30:00',
             dateEnd: '2026-02-16T3:59:00',
             type: 'project',
             expanded: true,
             connections: [
                 {
                     target: 1,
                     type: 0
                 }
             ],
             tasks: [
                 {
                     label: 'Task 1.1',
                     dateStart: '2026-02-20',
                     dateEnd: '2026-02-24',
                     type: 'task',
                     connections: [
                         {
                             target: 2,
                             type: 1
                         },
                         {
                             target: 4,
                             type: 1
                         }
                     ]
                 },
                 {
                     label: 'Task 1.2',
                     dateStart: '2026-2-15',
                     dateEnd: '2026-2-25',
                     type: 'task',
                     connections: [
                         {
                             target: 3,
                             type: 1
                         }
                     ]
                 }
             ]
         },
         {
             label: 'Task 2',
             dateStart: '2026-02-17T15:30:00',
             dateEnd: '2026-02-26T15:30:00',
             type: 'task'
         },
         {
             label: 'Milestone 1',
             dateEnd: '2026-02-20',
             type: 'milestone',
             connections: [
                 {
                     target: 5,
                     type: 1
                 }
             ]
         },
         {
             label: 'Task 3',
             dateStart: '2026-02-14T1:00:00',
             dateEnd: '2026-02-14T18:30:00',
             progress: 50,
             type: 'task'
         }
         ]
     });
 };

body.html

<div>
    <div class="demo-description">
        <b>nonworkingDays</b> colored in gray determine which days of the week are nonworking. Nonwokring days are
        ignored. This means that dropping a task in a nonworking day will add/remove slack time to it in order to
        recalculate the start/end date to a working date. Weekends are always colored in light blue.
    </div>
</div>
<div id="gantt"></div>
<div style="position: absolute; bottom: 5px; right: 5px;">
    <a href="https://www.jqwidgets.com/" alt="https://www.jqwidgets.com/"><img alt="https://www.jqwidgets.com/" title="https://www.jqwidgets.com/" src="https://www.jqwidgets.com/wp-content/design/i/logo-jqwidgets.png"></a>
</div>

Learn more

More jQuery Gantt demos