DayPilot.Gantt.tasks.businessEnd

The tasks.businessEnd() returns the adjusted end date of a task:

  1. Starts with the task’s current start date and its business-only duration.

  2. Scans the resulting date range for any cells marked non-business (weekends, holidays, etc.).

  3. Shifts the end date forward by the length of every non-business interval it encounters, so that the total business duration is preserved.

  4. Returns the final end date that now fully covers the original business duration plus any skipped non-business time.

The non-business cells can be defined using the onBeforeCellRender event handler.

Available since 2025.3.6564.

Declaration

DayPilot.Gantt.tasks.businessEnd(task, duration)

Parameters

  • task (DayPilot.Task) - the task for which the business end is calculated (only the start value is used)

  • duration (DayPilot.Duration) - the business-only duration

Return Value

  • DayPilot.Date object

  • or null if the specified tasks doesn’t belong to the Gantt chart component

Example

const gantt = new DayPilot.Gantt("dp", {
  // ...
});
gantt.init();

const duration = gantt.tasks.businessDuration(1);
const end = gantt.tasks.businessEnd(1, duration);
console.log(end);

See Also

Business Hours [doc.daypilot.org]

DayPilot.Gantt Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript