The tasks.businessEnd() returns the adjusted end date of a task:
Starts with the task’s current
startdate and itsbusiness-onlyduration.Scans the resulting date range for any cells marked
non-business(weekends, holidays, etc.).Shifts the end date forward by the length of every non-business interval it encounters, so that the total
businessduration is preserved.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
nullif 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]
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot