start_date
Description
Sets the start value of the time scale
start_date: Date | undefined
Example
gantt.config.start_date = new Date(2027, 8, 10);
gantt.config.end_date = new Date(2027, 8, 20);
gantt.init("gantt_here");
Details
note
To apply the start_date option, you must use it together with end_date.
- If both the start_date and end_date options are specified and you create a task outside that range, the task will disappear from the chart.
- Optional parameters of
init()can be used as initial values of start_date and end_date. - start_date and end_date overwrite fit_tasks. If you want to use these settings together, you'll need to manage the time scale from code.
In this case we can extend the range:
gantt.attachEvent("onLightboxSave", (taskId, task, isNew) => {
const taskStartDate = task.start_date;
const taskEndDate = task.end_date;
const scaleStartDate = gantt.config.start_date;
const scaleEndDate = gantt.config.end_date;
if (scaleStartDate > taskEndDate || scaleEndDate < taskStartDate) {
gantt.message({ type: "warning", text: "Warning! The task is outside the date range!", expire: 5000 });
return false;
}
return true;
});
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.