Our pure JavaScript Scheduler component


Post by Ivan Somov »

Hello guys!

I'm updating Scheduler setting new start and end dates directly to config, but when I setting dates that goes before current dates - I got an error:

Uncaught Error: Invalid start/end dates. Start date must less than end date.

Below code we use.
New startDate received -> New config set with new dates
pretty easy, but we got errors. also dates different with those which we use (or maybe I mistaking)

useEffect(() => {
        if (activePlanningCycle?.startDate) {
            setConfig({
                ...config,
                startDate: new Date(new Date(activePlanningCycle?.startDate).getTime() - 6.048e8),
                endDate: new Date(new Date(activePlanningCycle?.endDate).getTime() + 6.048e8),
            });
        }

    if (batchesData?.batches && routings && activePlanningCycle) {
        setBatches(converter(batchesData?.batches, routings, activePlanningCycle));
    }
}, [batchesData, activePlanningCycle]);

return batches ? (
    <BryntumScheduler
        {...config}
        events={batches?.events?.rows || []}
        resources={batches?.resources?.rows || []}
        timeRanges={batches?.timeRanges?.rows || []}
        columns={[
            {
                renderer: (props: any) => {
                    return props?.record?.data?.name;
                },
                text: 'Route',
                width: '200',
            },
        ]}
    />

I cannot attach screen recording here, but dates sometime really strange


Post by mats »

Sounds like a bug in your code somewhere, can you set a breakpoint and see what the values are of the new startDate + endDate? Also, please upload a simple test case then we can look at it too.


Post by Ivan Somov »

made quick check with console log
end date - strange, not that which was set

Attachments
Screenshot at May 06 11-57-07.png
Screenshot at May 06 11-57-07.png (50.59 KiB) Viewed 646 times
Screenshot at May 06 11-55-53.png
Screenshot at May 06 11-55-53.png (83.79 KiB) Viewed 646 times

Post by mats »

Please upload a simple test case then we can look at it.


Post by Ivan Somov »

another try

Attachments
EWmNaIFr7KA.jpeg
EWmNaIFr7KA.jpeg (418.27 KiB) Viewed 645 times

Post by Ivan Somov »

okay, I'll try to create case in sandbox
if you'll have ideas meanwhile - let me know please


Post by peaguilar »

Was there ever a resolution to this? We are experiencing the same issue. The start date will update, but then a random end date will be applied making the scheduler throw an error.


Post by marcio »

Hello peaguilar,

Could you please attach a sample project with your configuration reproducing that bug behavior?? You can add your code to one of our demos and share it here, it'll be a lot easier to help you with that :)

Best regards,
Márcio


Post Reply