vkurko / calendar

Full-sized drag & drop JavaScript event calendar with resource & timeline views
https://vkurko.github.io/calendar/
MIT License
964 stars 82 forks source link

Support to reset events. #253

Closed phpcodebooster closed 2 months ago

phpcodebooster commented 2 months ago

Right now when I load calendar initially I add all events. However when view changes from day to say week. I need to re fetch events based on week timeframe. This causes duplication in same events within a period earlier.

vkurko commented 2 months ago

Something is most likely wrong with the way you are loading data into the calendar. You don't need to force refetchEvents() to be called when navigating the calendar if you use eventSources. Can you show your code to make it clearer?

vkurko commented 2 months ago

Can you show your code to make it clearer?

@phpcodebooster any update on this?

phpcodebooster commented 2 months ago

@vkurko can you show me an example of how event source can be used effectively?

  1. on initial load fetching remote events
  2. creating new event and adding it manually to calendar works fine
  3. when I change calendar view from say week to month and call eventCalendar.updateEvent(e)) creates duplicates
vkurko commented 2 months ago

Please see this comment. If you still need further clarification, I will try to help.

phpcodebooster commented 2 months ago

@vkurko thanks for details I resolved this issue however now I am seeing different issue.

1) in my calendar toronto time GMT -4 hours. I am saving an event from 02:00 AM to 06:00 AM 2) I am saving this event in my database "end": "2024-04-10T10:00:00+00:00", "start": "2024-04-10T06:00:00+00:00" as UTC time because UTC is ahead 4 hours 3) when i supply this UTC date as events in my calendar my calendar shows me this event starts at 06:00 to 10:00 AM this is incorrect. I should see my original event time in my calendar which should be -4 hours behind UTC if given dates are in UTC "end": "2024-04-10T10:00:00+00:00", "start": "2024-04-10T06:00:00+00:00"

it should show me 02:00 AM to 06:00 AM not 06:00 AM to 10 AM

vkurko commented 2 months ago

Unfortunately, time zones are not currently supported in Event Calendar. Therefore, you need to convert the time yourself, for example, on the server side when preparing a response to the calendar.