bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
53 stars 6 forks source link

Duration is not being updated upon setting start and end date while using `setStartEndDate` #8881

Closed ghulamghousdev closed 4 months ago

ghulamghousdev commented 5 months ago

Forum post

I'm using the following code to change the event start date

        const currentStart = new Date(event.startDate);
        const start = new Date(currentStart.setDate(currentStart.getDate() + 1));
        event.setStartEndDate(start, event.endDate as Date);
        await eventStore.value.commit();

I would expect the start date to change and the end day to stay the same, making the event shorter. This does not happen though. After the EventStore.commit the event end date is recalculated to keep the length the same.

Code attached setStartEndDate.gif

package.zip

ghulamghousdev commented 5 months ago

Upon investigating this issue, it came to light that setStartEndDate method is not yet supported in SchedulerPro. The reason for this is, SchedulerPro uses a engine for scheduling and we need to implement the setStartEndDate method at the engine level. The bug was this method shouldn't be documented in the docs.

RytisLT commented 4 months ago

@SergeyMaltsev how was this issue fixed in 5.6.10? I can still reproduce the behavior with 5.6.10 and docs seems to be unchanged

> cat node_modules/@bryntum/schedulerpro/README.md | grep 5.6
npm install @bryntum/schedulerpro@5.6.10
yarn add @bryntum/schedulerpro@5.6.10
> cat node_modules/@bryntum/schedulerpro/schedulerpro.d.ts | grep -B 6 setStartEndDate
    /**
     * Sets the event start and end dates
     * @param {Date} start The new start date
     * @param {Date} end The new end date
     * @param {boolean} silent Pass `true` to not trigger events
     */
    setStartEndDate(start: Date, end: Date, silent?: boolean): void;
ghulamghousdev commented 4 months ago

Hi @RytisLT,

Thanks for bringing this to our intention. This is an issue with our internal decorator @hide. I have created a ticket here to fix it: https://github.com/bryntum/support/issues/9140