Premium support for our pure JavaScript UI components


Post by baseev »

Hello,

We are facing an issue with Bryntum Gantt where the duration is not being calculated when the calendar changes. Please find the attached video and example code base (cloned from Bryntum). Below files has the changes.

gantt-6.1.7/examples/advanced/lib/GanttToolbar.js - On onProjectCalendarSelected setting the project.hoursPerDay to the selected calendar hoursPerDay
gantt-6.1.7/examples/_datasets/launch-saas-advanced.json -- Added hoursPerDay, daysPerWeek and daysPerMonth for the calendar with id business and night.

Regards,
Baseev

Attachments
Advanced example.zip
(425.22 KiB) Downloaded 6 times
Screen Recording 2025-03-12 at 21.09.51.mov
(14.36 MiB) Downloaded 8 times

Post by tasnim »

Hi,

If you don't want the task duration to be affected by calendar, you could set https://bryntum.com/products/gantt/docs/api/Gantt/model/TaskModel#field-manuallyScheduled to true

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post by baseev »

Hi Tasnim,

I want the duration to be changed/re calculated according to the calendar selected. Also, I don't have have any resources assigned for the project.

Regards,
Baseev


Post by tasnim »

Hi,

In video you shared in your first post. it does seem to take effect. If you take a closer look at the task bar, you'll see after selecting business calendar the task bar becomes a bit smaller with calculation.

I apologize If I don't understand your requirement, would you mind rephrasing in a bit more detail about your use-case? What are you trying to achieve?

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post by baseev »

Hi Tasnim,

You’re right that the task bar is changing, but the value in the duration column stays the same. I was specifically referring to the duration column. For example, in the attached video, the duration remains 3 days for the selected row, even though the start and finish dates change.

Regards,
Baseev


Post by tasnim »

Hi,

That is expected behavior. The task duration gets calculated according to the calendar's hoursPerDay
Please study the guide here to learn more https://bryntum.com/products/gantt/docs/guide/Gantt/basics/calendars#calendars-and-duration-values

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post by baseev »

Hi,

hoursPerDay changes when the user selects the different calendar, if you carefully look at the video we are printing the hoursPerDay on the console too. Please have a look at the video and code which I have shared.

hoursPerDay for the Business calendar is : 8
hoursPerDay for the Night Shift calendar is : 2

According to your documentation (https://bryntum.com/products/gantt/docs/guide/Gantt/basics/calendars#calendars-and-duration-values) when there is a change in project hoursPerDay, it should recalculate the duration, but it is not.

Thanks,
Baseev


Post by ghulam.ghous »

Hey,

As Tasnim mentioned it is expected behaviour. Let me explain. When hoursPerDay is set to 8 for business calendar, the 8h considered a day. In business calendar, the working time for the day is 8 am to 12 pm and then 1 pm to 5 pm. This counts for 8h == 1 day. The value shown in the duration column will be 1 day. Now in the video 3 days duration is correct as hoursPerDay is 2 and the working time is from 10 pm to next day 8 pm in night shift calendar - 22 working in a day. And the duration of the task is 3 days so it will take 6 hours on the jan 14 to get completed. To further understand how it works, change the endDate of the task to 15 jan, you are gonna see 11 days in the duration column because 1 day technically has 24 hours and you set the 2 hoursPerDay on project and a day has 22 working hours, so 11 * 2 = 22 hours (equal to 1 working day). Is it clear now?

Plus an important thing to note here is we do not support hoursPerDay at calendar level yet. We have a ticket here to add this support: https://github.com/bryntum/support/issues/4132


Post Reply