It works as expected. Project start date is required to be passed to perform calculations. We take it as the earliest SPECIFIED date in the data. Not calculated date. And then we never update the project start date automatically. So you can try to update the project start date when the calculation is done and data is ready. There are 'refresh' and 'dataready' events on the project. There is a ticket to make them public: https://github.com/bryntum/support/issues/2019
So you can try to do the following (just a concept to show the idea):
const calcStartDate = taskStore => {
let startDate = taskStore.getTotalTimeSpan().endDate;
if (startDate) {
taskStore.forEach(task => {
if (task.startDate.getTime() <= startDate.getTime()) {
startDate = task.startDate;
}
});
}
return startDate;
};
gantt.project.on({
dataReady : () => {
const startDate = calcStartDate(gantt.taskStore);
if (startDate && (startDate.getTime() !== gantt.project.startDate?.getTime())) {
console.log('Project start date is updated');
gantt.project.startDate = new Date(startDate.getTime());
}
}
});