https://www.jqwidgets.com/

jQuery Gantt: Task deadline

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', {
         view: 'week',
         treeSize: '25%',
         durationUnit: 'hour',
         hideTimelineHeaderDetails: true,
         timelineHeaderFormatFunction: (date, type, isHeaderDetailsContainer, dateValue) => {
             if (!isHeaderDetailsContainer && type === 'day') {
                 return date.toLocaleDateString(this.locale, { day: 'numeric', month: 'short' });
             }
             return dateValue;
         },
         taskColumns: [
             {
                 label: '',
                 value: 'overdue'
             },
             {
                 label: 'Employee',
                 value: 'label'
             },
             {
                 label: 'From',
                 value: 'dateStart',
                 formatFunction: (value, item) => {
                     return item.dateStart.toLocaleDateString('en', { hour: '2-digit', minute: '2-digit' });
                 }
             },
             {
                 label: 'Deadline',
                 value: 'deadline',
                 formatFunction: (value, item) => {
                     if (!item.deadline) {
                         return '';
                     }
                     return new Date(value).toLocaleDateString('en', { hour: '2-digit', minute: '2-digit' });
                 }
             }
         ],
         source: [
             {
                 label: 'Stage 1',
                 synchronized: true,
                 deadline: '2026-10-30',
                 expanded: true,
                 tasks: [
                     {
                         label: 'Repairs',
                         dateStart: '2026-10-28T02:30:00',
                         duration: 9.5,
                         progress: 45,
                         deadline: '2026-10-28T11:00:00',
                     },
                     {
                         label: 'Rally',
                         dateStart: '2026-10-28T13:30:00',
                         duration: 12,
                         deadline: '2026-10-29T03:00:00'
                     },
                     {
                         label: 'Rankings Update',
                         dateStart: '2026-10-29T07:30:00',
                         duration: 8,
                         deadline: '2026-10-29T17:30:00'
                     }
                 ]
             },
             {
                 label: 'Stage 2',
                 synchronized: true,
                 deadline: '2026-10-31:23:30:00',
                 expanded: true,
                 tasks: [
                     {
                         label: 'Repairs & Optimizations',
                         dateStart: '2026-10-30T07:30:00',
                         duration: 6,
                         deadline: '2026-10-30T14:00:00'
                     },
                     {
                         label: 'Stastics',
                         dateStart: '2026-10-31T07:30:00',
                         duration: 8
                     }
                 ]
             },
             {
                 label: 'Stage 3',
                 synchronized: true,
                 expanded: true,
                 tasks: [
                     {
                         label: 'Preparation',
                         dateStart: '2026-11-01T06:30:00',
                         duration: 6,
                         deadline: '2026-11-01T12:00:00',
                     },
                     {
                         label: 'Rally',
                         dateStart: '2026-11-01T013:00:00',
                         duration: 13
                     },
                     {
                         label: 'Final Rankings',
                         dateStart: '2026-11-02T7:30:00',
                         duration: 12,
                         deadline: '2026-11-02T23:30:00'
                     },
                     {
                         label: 'Awards',
                         dateStart: '2026-11-03T06:00:00',
                         duration: 12,
                         deadline: '2026-11-04'
                     }
                 ]
             }
         ]
     })
 };

body.html

<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