简体   繁体   中英

Fullcalendar recurring event is shifted for the day before

This is the situation we are having. User is in Pacific Time zone and wants to create recurring event:

  • start date: 11/22/2021
  • end date: 11/29/2021
  • start time: 6:30pm
  • end time: 8:30pm
  • recurring days: Monday, Thursday
  • frequency: weekly

Fullcalendar timeZone is set to 'local', and we are converting time to UTC. So when we convert user input we have rrule object created like this:

"rrule": {
    "freq": 2,
    "interval": 1,
    "byweekday": [
        0,
        3
    ],
    "dtstart": "2021-11-23T02:30:00Z",
    "until": "2021-11-30T04:30:00Z"
}

But the event gets pushed back one day: event is repeated on Sunday and Wednesday instead of Monday and Thursday.

在此处输入图像描述

When we create event where PT time and UTC time are 'in the same day' (eg from 3pm to 4pm), everything is fine.

在此处输入图像描述

Also, when we create non-recurring event from 6:30pm to 8:30pm, everything is fine.

Fullcalendar version is 5.9.0 and rrule version is 2.6.8.

What are we missing?

You've specified the event to occur at 02:30:00Z every Monday and Thursday within the specified date range.

Note that that's Monday and Thursday in UTC time.

In Pacfic Time, 02:30:00Z is 18:30:00 the previous day. Therefore, an event recurring early on a Thursday morning in UTC time will actually occur on a Wednesday evening in Pacific Time.

What fullCalendar is doing is completely correct and logical according to the data it's been given.

Where I think your issue is likely to be, is that when you're receiving this recurring event request from the user and converting the date and time to UTC, you're not taking into account whether that timezone change also logically affects the recurrence days specified. eg I assume in the case mentioned above you'd want to shift the recurrence days one day forward, since the UTC conversion causes the time to shift into the next day.

It depends how exactly you'll want it to work, and obviously I can't see how you do the conversion process currently, so I'll have to leave the implementation details up to you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM