Hi Team,
I’m using the PRO version of Gantt and facing issues after implementing multiple calendar support in my app.
My requirement is to allow different tasks to have different calendars assigned, and accordingly, their durations should be computed dynamically. I’m using my own backend scheduler to calculate end_date
, while the frontend (Gantt) sends start_date
and duration
. At the database level, I’m storing duration and date values in ISO strings (e.g., "PTnH"
, where n
is the number of hours).
In this setup, the frontend needs to send computed durations based on the calendar assigned to each task and its working time configuration. For example:
tasks: [
{
"Task A": {
"duration": "2 days",
"calendar": "24/7",
"expectedPayload": "PT48H"
}
},
{
"Task B": {
"duration": "3 days",
"calendar": "Standard (8h/day, Mon-Fri)",
"expectedPayload": "PT24H"
}
},
{
"Task C": {
"duration": "1 day",
"calendar": "12h Calendar (8AM–8PM, Mon-Fri)",
"expectedPayload": "PT12H"
}
}
]
This worked fine in a single-calendar setup, where I had hardcoded "1 day = PT8H"
in JavaScript and multiplied days by a fixed hoursPerDay
. But this approach doesn’t scale for multiple calendars, as each may define different working times.
My questions are:
- Feasibility – Is it possible to handle this calculation correctly on the frontend level when using multiple calendars?
-
Parsing backend response – Can Gantt parse the backend response based on the
calendar_id
attached to each task? For example, if I send"PT24H"
or"PT120H"
, can Gantt automatically convert these ISO hour values into days according to the assigned calendar’s working hours/days and display them correctly in the UI?
The calendar_id
is already available in the task data, and I can see the correct calendar name in the Lightbox when editing tasks.
I hope this explanation makes sense. Could you please advise on the best way to handle duration conversions in multi-calendar scenarios on the frontend?
Thanks!