Our pure JavaScript Scheduler component


Post by burnit »

Hi,

today i can calculate the endDate by using the generator function 'calculateProjectedXDateWithDuration' when i pass in the startDate and duration of the event.

But how can i calculate the end date, based on another calendar?
(for example: event is assigned to calendar 'twoShifts' but i want to calculate the end date based on calendar 'threeShifts'

Many thanks.


Post by alex.l »

Hi, try to call in calendar you need calculateEndDate method.

const endDate = gantt.project.calendarManagerStore.getById('general').calculateEndDate(startDate, duration);

All the best,
Alex


Post by burnit »

Thanks for this great idea!

But i am facing this issue:

Screenshot 2023-05-29 173531.png
Screenshot 2023-05-29 173531.png (7.45 KiB) Viewed 123 times

So my input is my startDate as date and my duration as number.
But the output is exactly the same as my start Date or the beginning of the working interval.
Any idea what the reason could be?

                  console.log(form.startDate, form.duration);
                  const endDate = calendarStore
                    .getById(values.target.value)
                    .calculateEndDate(form.startDate, form.duration);
                  console.log(endDate);

Post by alex.l »

Yes, I actually forgot to mention that duration must be in milliseconds. Sorry about that.

All the best,
Alex


Post by burnit »

Works! Thanks a lot!


Post Reply