Hi and thank you for your reply.
What would I then need to do to add intervals to the 'weekends' calendar?
Please see API methods:
https://www.bryntum.com/docs/gantt/#SchedulerPro/model/CalendarModel#function-addIntervals
https://www.bryntum.com/docs/gantt/#SchedulerPro/model/CalendarModel#function-addInterval
Also subscribe to the ticket above to get notified when it is fixed
Pavlo Miklashevych
Sr. Frontend Developer
addInterval is a function on Calendar model. CalendarManagerStore is a tree store which holds Calendar models. So you need to find the calendar you want to modify, call addInterval on it, and pass a config which describes CalendarIntervalModel. To find a calendar you can use getById, findRecord, etc. For example, if there is a calendar with id "weekends" you can do:
// The 1st of Jan is a holiday
project.calendarManagerStore.getById('weekends').addInterval({
startDate : '2021-01-01',
endDate : '2021-01-02',
isWorking : false
})
Basically, you can find the info above in this guide: https://www.bryntum.com/docs/gantt/#guides/calendars.md#availability-intervals
Please describe what problem you're trying to solve. How do you use calendars in your project? Do you have one calendar for the project and resources and only want to provide an option to add holidays to the main calendar?
Pavlo Miklashevych
Sr. Frontend Developer
Hi pmiklashevich,
My question is how to use Calendar. We offer our users to create calendar but on the Scheduler, we just want to display the holidays and I am doing a fetch for the holidays for a specific client and then trying to add it to the project calendar so that the event can skip the holidays.
Also, it looks like that the types are not correct.
// eslint-disable-next-line
// @ts-ignore
pulseProject.calendarManagerStore
.getById('weekends')
// eslint-disable-next-line
// @ts-ignore
.addInterval({ startDate: new Date(2021, 0, 15), endDate: new Date(2021, 0, 15), isWorking: false });
I'm getting a type error on addInterval
Also could I ask why the interval has to be 1 day after? The normal grid does not have that behaviour. If booking start and endDate is 01/01/2021, it will display properly...
Hello!
My question is how to use Calendar. We offer our users to create calendar but on the Scheduler, we just want to display the holidays and I am doing a fetch for the holidays for a specific client and then trying to add it to the project calendar so that the event can skip the holidays.
If you have a calendar per client, you can download the calendar and use it as the main calendar for the project. If your project has some common rules for all clients, the user calendar can extend the common calendar (when it is a child of the calendar).
I'm getting a type error on addInterval
We will check and fix the typings.
Also could I ask why the interval has to be 1 day after? The normal grid does not have that behaviour. If booking start and endDate is 01/01/2021, it will display properly...
This is how time on the timeline works. 01/01/2021 means a point on the timeline 2021-01-01 00:00:00. If you need a time range of one day, you need to produce 2 points on the timeline to have 24 hours in between. Nevertheless you can display end date -1day on the screen. That is up to your application.
Best,
Pavel
Pavlo Miklashevych
Sr. Frontend Developer