vkurko / calendar

Full-sized drag & drop JavaScript event calendar with resource & timeline views

Home Page:https://vkurko.github.io/calendar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Method updateEvent bug

IndyHendrickx opened this issue · comments

I may have found another bug. When I update an event with the same event properties, my event is jumping forward in time (2 hours to be exact). I currently implemented a fix to subtract 2 hours from the start and end properties before reassigning the values. I wanted to store the DOM element inside the extendedProps, so I could create a custom tooltip for the event.

Here is the function I created, the onMount function is triggered by the eventDidMount:

function onMount(data) {
    let event = findEvent(calendar, data.event.id);
    // Correct timezone for event properties (bug in library)
    event.start.setHours(event.start.getHours() - 2);
    event.end.setHours(event.end.getHours() - 2);
    // Merge objects
    let extendedProps = { extendedProps: { el: data.el } };
    let total = { ...event, ...extendedProps };
    // Update calendar event and set popover
    calendar.updateEvent(total);
    setPopover(data.event.id, event);
}

My timezone: Central European Summer Time (GMT+2).
Thanks for looking into this!

If you use the built-in methods to manipulate events, then everything will be fine. I have version 1.1.1 ready with a fix for your previous issue, but I can't publish it yet because npmjs is having some login issues right now.

If you use the built-in methods to manipulate events

Just to make it clear, calendar.getEvents() should be used instead of calendar.getOption("events").

If you use the built-in methods to manipulate events

Just to make it clear, calendar.getEvents() should be used instead of calendar.getOption("events").

Great, thank you so much!