DurationUnit defined on SfGantt element is ignored if GanttTaskFields.StartDate is empty

I have a weird bug where I have defined DurationUnit on the SfGantt element, but it only works if the StartDate of the elements is not empty.

Markup for SfGrid element looks like this: 

<SfGantt DataSource="@TaskCollection" DurationUnit="DurationUnit.Hour">
        <GanttTaskFields Id="TaskId" Name="TaskName" Duration="Duration" Dependency="Dependency" StartDate="StartDate"/>
</SfGantt>

If I add data like this the DurationUnit is correctly set to be hours:

@code {
List<GanttDTO> TaskCollection = new List<GanttDTO>
{
new GanttDTO { TaskId = 1, TaskName = "Prufa 1", Duration = "12", StartDate = DateTime.Now },
new GanttDTO { TaskId = 2, TaskName = "Prufa 2", Duration = "24", Dependency = "1", StartDate = DateTime.Now },
new GanttDTO { TaskId = 3, TaskName = "Prufa 3", Duration = "48", Dependency = "2", StartDate = DateTime.Now },
new GanttDTO { TaskId = 4, TaskName = "Prufa 4", Duration = "16", Dependency = "2", StartDate = DateTime.Now }
};
}

But if I don't define the start date the DurationUnit is ignored and uses days:

@code {
List<GanttDTO> TaskCollection = new List<GanttDTO>
{
new GanttDTO { TaskId = 1, TaskName = "Prufa 1", Duration = "12" },
new GanttDTO { TaskId = 2, TaskName = "Prufa 2", Duration = "24", Dependency = "1" },
new GanttDTO { TaskId = 3, TaskName = "Prufa 3", Duration = "48", Dependency = "2" },
new GanttDTO { TaskId = 4, TaskName = "Prufa 4", Duration = "16", Dependency = "2" }
};
}


If i then try to set the DurationUnit with the duration attribute it works again: 

@code {
List<GanttDTO> TaskCollection = new List<GanttDTO>
{
new GanttDTO { TaskId = 1, TaskName = "Prufa 1", Duration = "12hours" },
new GanttDTO { TaskId = 2, TaskName = "Prufa 2", Duration = "24hours", Dependency = "1" },
new GanttDTO { TaskId = 3, TaskName = "Prufa 3", Duration = "48hours", Dependency = "2" },
new GanttDTO { TaskId = 4, TaskName = "Prufa 4", Duration = "16hours", Dependency = "2" }
};
}

1 Reply

MS Monisha Sivanthilingam Syncfusion Team October 28, 2021 11:01 AM UTC

Hi Heidar, 
 
Greetings from Syncfusion support. 
 
We were able to replicate the issue you reported. We have considered it as a bug and have logged a bug report for it. You can track its status from the below feedback link. 
 
 
The fix will be provided in the upcoming Volume 3 SP release scheduled for the mid of November, 2021. 
 
We appreciate your patience until then. 
 
Regards, 
Monisha. 


Loader.
Up arrow icon