Page 1 of 1

Gantt 5.0.0 - create complex recurring resource calendars

Posted: Tue Jul 19, 2022 7:56 pm
by MauriceLapre

Hi,

I'm trying to setup resource calenders for complex recurring shifts. E.g. a 14 day shift should set a calendar's working hours to:

  • day 1: 8hrs

  • day 2: 8hrs

  • day 3: 8hrs

  • day 4: 8hrs

  • day 5: 0hrs

  • day 6: 0hrs

  • day 7: 8hrs

  • day 8: 8hrs

  • day 9: 8hrs

  • day 10: 8hrs

  • day 11: 8hrs

  • day 12: 0hrs

  • day 13: 0hrs

  • day 14: 0hrs

This will be recurring (every 14 days), starting on a specific date, e.g. Monday July 18th 2022. By setting recurring isWorking=true intervals like "on Monday at 08:00" for 14 days, the first week is overwritten. I can't figure out yet how to do this. Any help would be appreciated, thanks!


Re: Gantt 5.0.0 - create complex recurring resource calendars

Posted: Fri Jul 22, 2022 10:57 pm
by marcio

Hi Maurice,

Sorry for the late reply. Considering that day 1 is a Monday, you can setup your data like this:

{
    "success"     : true,
    "project"     : {
        "calendar" : "workhours"
    },
    "calendars"   : {
        "rows" : [
            {
                "id"                       : "workhours",
                "name"                     : "Working hours",
                "unspecifiedTimeIsWorking" : true,
                "intervals"                : [
                    {
                        "recurrentStartDate" : "on Thu every 1 week",
                        "recurrentEndDate"   : "on Sat every 1 week",
                        "isWorking"          : false,
                        "name"               : "non working time 1"
                    },
                    {
                        "recurrentStartDate" : "on Sat every 2 weeks",
                        "recurrentEndDate"   : "on Sun every 2 weeks",
                        "isWorking"          : false,
                        "name"               : "non working time 2"
                    }
                ]
            }
        ]
    },
}

You can check more info about the intervals at Later.js page https://bunkat.github.io/later/index.html


Re: Gantt 5.0.0 - create complex recurring resource calendars

Posted: Wed Aug 10, 2022 9:31 am
by MauriceLapre

Thanks for your reply, that's getting close to what I want. But I'd like the recurrence to be fully custom. Shifts can e.g. also be a 10 day recurring schedule. I'm reading the later.js doc about custom time periods, but how can I create that? E.g. custom period is 10 days. Then use this to implement a recurring schedule like: on the 1st day of custom period, 8hrs working (with recurring start and end date/time). And on the 2nd day of custom period, 8hrs working and so on...
Is something like that possible?


Re: Gantt 5.0.0 - create complex recurring resource calendars

Posted: Thu Aug 11, 2022 11:21 am
by alex.l

Try to specify rules like

"recurrentStartDate" : "every 14 days at 6:00 after 2021-03-30T00:00:00 before 2021-04-15T00:00:00",
"recurrentEndDate" : "every 14 days at 22:00 after 2021-03-30T00:00:00 before 2021-04-15T00:00:00",

Just as example.

Full docs you can find in docs of later.js https://bunkat.github.io/later/parsers.html


Re: Gantt 5.0.0 - create complex recurring resource calendars

Posted: Fri Sep 23, 2022 3:01 pm
by MauriceLapre

Tried that, unfortunately that took every new month into account.

After a lot of puzzling, what seems to be working:

at 08:00 on the 2nd day of the week every 2 weeks starting on the 1st week of the year

For the first 7 days of the 14 day period. And:

at 08:00 on the 3rd day of the week every 2 weeks starting on the 2nd week of the year

For the second 7 days of the 14 day period.


Re: Gantt 5.0.0 - create complex recurring resource calendars

Posted: Fri Sep 23, 2022 3:13 pm
by marcio

Hey MauriceLapre,

Glad that you figure it out! Thanks for sharing also the solution for future checking.


Re: Gantt 5.0.0 - create complex recurring resource calendars

Posted: Fri Sep 23, 2022 3:50 pm
by MauriceLapre

No problem. Just one thing. On weeks and months, the first day (e.g. "first day of the week") is always Sunday. European calendar says the first day is Monday. Can I change that somewhere?


Re: Gantt 5.0.0 - create complex recurring resource calendars

Posted: Fri Sep 23, 2022 4:07 pm
by marcio

Do you mean the view?? Perhaps you're looking for https://www.bryntum.com/docs/gantt/api/Core/util/Month#config-weekStartDay