简体   繁体   English

Fullcalendar 重复事件转移到前一天

[英]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开始日期:2021 年 11 月 22 日
  • end date: 11/29/2021结束日期:2021 年 11 月 29 日
  • start time: 6:30pm开始时间:下午 6:30
  • end time: 8:30pm结束时间:8:30 PM
  • recurring days: Monday, Thursday重复日:周一、周四
  • frequency: weekly频率:每周

Fullcalendar timeZone is set to 'local', and we are converting time to UTC. Fullcalendar 时区设置为“本地”,我们将时间转换为 UTC。 So when we convert user input we have rrule object created like this:因此,当我们转换用户输入时,我们创建了这样的规则 object:

"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.当我们创建 PT 时间和 UTC 时间“在同一天”(例如从下午 3 点到 4 点)的事件时,一切都很好。

在此处输入图像描述

Also, when we create non-recurring event from 6:30pm to 8:30pm, everything is fine.此外,当我们从下午 6:30 到晚上 8:30 创建非重复事件时,一切都很好。

Fullcalendar version is 5.9.0 and rrule version is 2.6.8. Fullcalendar 版本为 5.9.0,规则版本为 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.您已指定事件在指定日期范围内的每周一和周四凌晨02:30:00Z发生。

Note that that's Monday and Thursday in UTC time.请注意,这是UTC时间的星期一和星期四。

In Pacfic Time, 02:30:00Z is 18:30:00 the previous day.在太平洋时间, 02:30:00Z是前一天的18:30:00 Therefore, an event recurring early on a Thursday morning in UTC time will actually occur on a Wednesday evening in Pacific Time.因此,在 UTC 时间的星期四早上再次发生的事件实际上将在太平洋时间的星期三晚上发生。

What fullCalendar is doing is completely correct and logical according to the data it's been given.根据给出的数据,fullCalendar 所做的事情是完全正确和合乎逻辑的。

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.我认为您的问题可能出在哪里,当您收到用户的此重复事件请求并将日期和时间转换为 UTC 时,您没有考虑该时区更改是否在逻辑上也会影响重复天数指定的。 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.例如,我假设在上述情况下,您希望将重复日期提前一天,因为 UTC 转换会导致时间转移到第二天。

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.这取决于您希望它如何工作,显然我目前看不到您如何进行转换过程,因此我将不得不将实现细节留给您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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