kalend icon indicating copy to clipboard operation
kalend copied to clipboard

Agenda and Calendar view display event in the wrong day

Open the-spelletier opened this issue 1 year ago • 2 comments

In Agend and Calendar view, events that are close to end of day are displayed on the next day instead. The bug happens when you create a bug within the timezone offset of the range. The event is displayed correctly (right start and end times), but the event is on the next day.

To Reproduce Steps to reproduce the behavior:

  1. Create a Kalend component with the desired Timezone (i.e 4 hours offset)
  2. Add event with the same timezone withing this offset (i.e. for 4 hours offset, create it between 8 PM and Midnight)
  3. In Agenda/Calendar view, the events shows up on the wrong date

Expected behavior The event should always be converted to the specified timezone (Kalend timezone param) and should show up in the correct day for those two views.

Screenshots In this example, event is on the 25th from 10 PM to 11 PM for a timezone with 4 hours offset. Screen Shot 2022-07-25 at 12 21 12 PM

Desktop (please complete the following information):

  • OS: MacOS, Windows
  • Browser: Chrome
  • Version: 0.15.0

Smartphone (please complete the following information):

  • Device: Samsung Galaxy A71 , iPhone 12
  • OS: Android, iOS
  • Browser: Chrome
  • Version: 0.15.0

Additional context After looking through your code, it might be that the problem is in validations like isTodayOrInFuture

What I did to work around this issue

  • Force current timezone or UTC to the Kalend component
  • Force current timezone or UTC to the events
  • Tried passing luxon for event date instead of our usual date lib

the-spelletier avatar Jul 25 '22 16:07 the-spelletier

Hi,

thank you, I was able to replicate bug when creating new event. I fixed some problems, but knowing how timezones could be tricky, I believe it might take some more tweaking to make this right for all cases.

Could you please check new version 0.15.1, if you see improvement?

nibdo avatar Jul 26 '22 20:07 nibdo

I guess I also ran into that problem.

When displaying a e.g. 2-day all day event, the follow-up day of day 2 is also covered by the event. Here is a reproducible example.

In contrast to @the-spelletier use case, I also tried to specify the dates in UTC timezone. E.g.

{
    id: 1,
    startAt: "2022-08-25T00:00:00.000Z",
    endAt: "2022-08-26T23:59:59.999Z",
    timezoneStartAt: "UTC",
    timezoneEndAt: "UTC",
    summary: "2 days",
    color: "orange",
    calendarID: "simple",
    allDay: true
  }

renders the event on the 25th, 26th, and 27th, which is wrong. Screenshot 2022-08-05 at 11 13 49

By playing around a little bit, I recognized that the "magical" time line is at 11:59:59.999. So endAt: "2022-08-26T11:59:59.999Z" renders the event correctly and from endAt: "2022-08-26T12:00:00.000Z" on it is rendered wrong.

Kalend version is 0.15.1.

Edit: As it can be seen with the reproducible example, for single day all day events the issue does not occur.

yss14 avatar Aug 05 '22 09:08 yss14

Thank you for examples. This case should be fixed in new version.

nibdo avatar Aug 18 '22 19:08 nibdo