icalendar - 如何在 iCalendar Recurrence 规则中处理由于 DST 导致的不存在时间戳?
问题描述
我正在尝试确定 RFC 5545 中指定的重复规则是否适合我的用例。我对第 3.3.10 节有点困惑。https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.10
有两段我认为是矛盾的:
Recurrence rules may generate recurrence instances with an invalid
date (e.g., February 30) or nonexistent local time (e.g., 1:30 AM
on a day where the local time is moved forward by an hour at 1:00
AM). Such recurrence instances MUST be ignored and MUST NOT be
counted as part of the recurrence set.
和
If the computed local start time of a recurrence instance does not
exist, or occurs more than once, for the specified time zone, the
time of the recurrence instance is interpreted in the same manner
as an explicit DATE-TIME value describing that date and time, as
specified in Section 3.3.5.
为了更好地衡量,第 3.3.5 节的相关部分
If, based on the definition of the referenced time zone, the local
time described occurs more than once (when changing from daylight
to standard time), the DATE-TIME value refers to the first
occurrence of the referenced time. Thus, TZID=America/
New_York:20071104T013000 indicates November 4, 2007 at 1:30 A.M.
EDT (UTC-04:00). If the local time described does not occur (when
changing from standard to daylight time), the DATE-TIME value is
interpreted using the UTC offset before the gap in local times.
Thus, TZID=America/New_York:20070311T023000 indicates March 11,
2007 at 3:30 A.M. EDT (UTC-04:00), one hour after 1:30 A.M. EST
(UTC-05:00).
所以在我看来,在引用的第一段中,不存在的时间戳被跳过,但在第二段中,它们被重新解释为确实存在的时间戳。哪个是实际指定的行为?
解决方案
这归结为是否可以调整重复实例的无效日期/时间。
想到的一个例子是,当在 iCalendar 中指定时区时,我们知道事件发生时间的 UTC 偏移量是多少。因此,当重复实例落在无效时间时,可以使用与 UTC 的偏移量将其调整为正确的时间。(第 2 段是这里的预期行为)。
如果 iCalendar 没有设置时区,则没有 UTC 偏移量。因此没有办法调整无效时间。(第 1 段是预期的行为)。
例如:
如果我对你说。每天凌晨 1:30 在您的日历中创建提醒。在您的当地时间(由于 DST)一年中会有一天凌晨 1:30 不存在,那么您应该怎么做?我没有告诉你在这种情况下该怎么做,所以你需要忽略它。如果您将它调整一个小时,这可能与另一个事件发生冲突,并且它正在做出假设。
但是,如果我说每天为 BST 上午 7:30 (UTC+1) 创建提醒,您将在当地时间凌晨 1:30 (UTC-5) 将其添加到您的日历中,当这一天到来并且时钟为您改变时, 凌晨 1:30 无效。但是 BST 早上 7:30 仍然是有效时间,我已经给了你足够的信息来确定你所在时区 EDT(UTC -4) 的时间。BST 比 UTC 早 1 小时, EDT 比 UTC 晚 4 小时,因此我们可以将时间调整 5 小时。上午 7:30 现在将变为您日历的上午 2:30,而不是上午 1:30。
推荐阅读
- firebase - Firebase Google Auth:即使启用了“身份提供者配置已禁用”
- java - Java:在命令时间之前执行的计时器
- asterisk - Gotoif如何设置它以允许3或4位响应满足条件
- c# - C# - 如何在用户设置中保存文本框和复选框
- reactjs - 元素类型无效:应为字符串(用于内置组件)或类/函数(用于复合组件)但得到:数字
- javascript - ImageMapType Typescript 中的授权标头
- c# - 根据另一个自动完成文本框的选定文本填充文本框 c# winforms
- javascript - Express.js:指定根路由会破坏静态文件解析
- php - 调用get Followers/following api时如何将相互关注者/关注者放在数组顶部?
- javascript - 单选按钮的html&js vadilation