Hi,
I think I may have found a small issue in TTMSFNCGanttWorkTime, but I'm not entirely certain I'm reading it correctly — so please take this as a question rather than a bug report.
Environment: Delphi 13.1, VCL, TMS FNC Gantt Chart 1.3.3.6 (tms.fnc.ganttchart), unit VCL.TMSFNCGanttClasses.pas
GetActualStartDateTimeByEnd ends like this:
tempD := tempD - tl;
end
else
tempD := ADateTime + ADuration.AsTime; // taken when AWorkTimePolicy = whAllTime
Result := tempD;
end;
The else branch is the one used for whAllTime, and it adds the duration. Since this function is the backward counterpart of GetActualEndDateTime, I would have expected a subtraction here. The line is identical to the corresponding one in GetActualEndDateTime, where adding is of course correct.
A small repro:
var
Dur: TTMSFNCGanttDuration;
Res: TDateTime;
begin
Dur := TTMSFNCGanttDuration.Create(nil);
try
Dur.SetDuration(gdtWorkDays, 3);
Res := GanttChart1.Project.WorkTime.GetActualStartDateTimeByEnd(
EncodeDate(2026, 7, 29), Dur, whAllTime);
// expected: 2026-07-26
// returned: 2026-08-01
finally
Dur.Free;
end;
end;
With whWorkDaysOnly and whWorkTimeAndDays the function behaves exactly as documented — only the whAllTime path is affected, which may be why it hasn't come up before.
One thing worth adding for anyone else running into this: the component's own scheduling does not appear to be affected. TTMSFNCGanttTask.GetPlannedStartForDependency handles whAllTime separately before it ever calls into WorkTime, so the behaviour only shows up when calling the method directly. I've taken the same approach as a workaround in my own code, so there's no urgency on my side.
Could you confirm whether this is indeed unintended, or whether the whAllTime case is meant to behave differently here?
Thanks!