getSubtaskDuration
Description
Calculates the combined duration of tasks nested in a project or another task.
getSubtaskDuration: (task_id?: string | number) => number
Parameters
task_id- (optional) string | number - the task's id, root_id will be used if not specified
Returns
duration- (number) - total duration of nested tasks
Example
const formatter = gantt.ext.formatters.durationFormatter();
//duration of the whole project
let duration = gantt.getSubtaskDuration();
console.log(formatter.format(duration));
//duration of the subproject
duration = gantt.getSubtaskDates(1);
console.log(formatter.format(duration));
Details
Calculates the combined duration of tasks nested in a project or another task.
Tasks of the project type are not counted in the total duration.
The return value is calculated in duration units from the config.
Related API
Related Guides
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.