Our powerful JS Calendar component


Post by dansmithcreates »

greets Animal, et al!

this is a followup to viewtopic.php?t=31709

What is the same idea for checking double click and the right click context menu (prevent the creation of events in the past?)

I did look at beforeCreateMode. It is not clear what there should be as a return value, if a date is in the past. It's not a simple true / false, is it?

the beforeDragCreate() works fine. Just turning my attention to the double click and right click cases.


Post by Animal »

I updated that example to disable all things in the past.


Post by dansmithcreates »

very good, thanks!

there is one more: dont drag events to the past :)

const beforeDragMoveEnd = async ({ newEndDate }) => {
    if (newEndDate < new Date()) {
        const result = await MessageDialog.alert({
            title: "Alert",
            message: "Cannot move event to the past",
        });
        return false;
    }
};

I think we've got it now!


Post by Animal »

What we need is a preventable event that fires during a drag.

Take another look at the example. I've added a workaround which injects a handler into the Drag feature which fires an event.

I think we need to add this. Validation should be available during the drag, not just at the end.


Post by dansmithcreates »

cool, thanks

when you look at all the events we need to cover, in order to prevent the modification of the past, it does start to point back to a global variable such as historyIsReadOnly: true

however, that's an involved internals thing that you'd put on your roadmap, and I imagine it's sorta "medium" priority.. not a bug, but a "nice to have". We've figured out how to work with it for now :). thanks!


Post Reply