Outlook 将 iCalendar UTC 日期/时间视为重复事件的浮动日期/时间
我正在根据基于 PHP/Zend Framework 的日历应用程序中的事件创建 iCalendar 文件。我将日期/时间转换为 UTC,以避免处理指定时区的问题。如果我导入一次性事件,Outlook 会正确解释 UTC 时间并以我的本地时区(东部时间(美国和加拿大))显示它。当我导入重复事件时,Outlook 忽略日期/时间采用 UTC 格式这一事实,并将其视为“浮动”。
这是正确导入的一次性事件:
BEGIN:VCALENDAR
PRODID:My Calendar Application
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:20110713T143920Z
DTSTART:20110713T110000Z
DTEND:20110713T120000Z
SUMMARY:iCalendar Breakfast
DESCRIPTION:Eat more breakfast!
CATEGORIES:Meals
END:VEVENT
END:VCALENDAR
这是无法正确导入的重复事件:
BEGIN:VCALENDAR
PRODID:My Calendar Application
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:20110713T142549Z
DTSTART:20110711T220000Z
DTEND:20110711T230000Z
SUMMARY:iCalendar Dinner
DESCRIPTION:This maps to the iCalendar DESCRIPTION field.
CATEGORIES:Meals
RRULE:FREQ=DAILY;UNTIL=20110715T230000Z;INTERVAL=1
END:VEVENT
END:VCALENDAR
时间应为东部时间(美国和加拿大)下午 6 点到晚上 7 点,但在 Outlook 中显示为晚上 10 点到晚上 11 点。
I am creating an iCalendar file from an event in my PHP/Zend Framework based calendar application. I am converting the date/time to UTC to avoid dealing with specifying the time zone with them. If I import a one-time event, Outlook properly interprets the UTC time and displays it in my local time zone (Eastern Time (US & Canada)). When I import a recurring event, Outlook is ignoring the fact that the date/time is in UTC and treats it as "floating".
This is the one-time event that imports properly:
BEGIN:VCALENDAR
PRODID:My Calendar Application
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:20110713T143920Z
DTSTART:20110713T110000Z
DTEND:20110713T120000Z
SUMMARY:iCalendar Breakfast
DESCRIPTION:Eat more breakfast!
CATEGORIES:Meals
END:VEVENT
END:VCALENDAR
This is the recurring event that does not import properly:
BEGIN:VCALENDAR
PRODID:My Calendar Application
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:20110713T142549Z
DTSTART:20110711T220000Z
DTEND:20110711T230000Z
SUMMARY:iCalendar Dinner
DESCRIPTION:This maps to the iCalendar DESCRIPTION field.
CATEGORIES:Meals
RRULE:FREQ=DAILY;UNTIL=20110715T230000Z;INTERVAL=1
END:VEVENT
END:VCALENDAR
The time should be from 6pm to 7pm for Eastern Time (US & Canada), but is showing as 10pm to 11pm in Outlook.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我正在阅读 iCalendar 规范,发现这个小段落:
我能够使用
date_default_timezone_get()
像这样:简单地进行更改就可以解决问题,但我的 ics 文件不符合 iCalendar 标准,因为我不知道如何根据该值生成“VTIMEZONE”日历组件从
date_default_timezone_get()
。I was reading the iCalendar spec, and found this little paragraph:
I was able to use
date_default_timezone_get()
like this:Simply making that change fixed the issue, but my
ics
file is not iCalendar compliant because I don't know how to generate the "VTIMEZONE" calendar component based on the value fromdate_default_timezone_get()
.Z 后缀表示 UTC 时区,而不是“浮动”
对于 DTSTART 和 DTEND,请关闭 Z。然后严格来说日历应用程序应该使用自己的时区加载它。
浮动事件仅对个人事物有意义,例如按照您的示例“吃早餐”。切勿用于可能由不同时区的人共享/查看的事件,因为它们显然不匹配。
来自 https://www.rfc-editor.org/rfc/rfc5545
日期本地时间形式只是一个日期时间值
不包含 UTC 指示符,也不引用时间
区。例如,以下表示 1998 年 1 月 18 日
晚上 11 点:
the Z suffix means UTC timezone, not 'floating'
For the DTSTART and DTEND, Leave the Z off. Then strictly speaking calendar apps should load it using their own timezone.
Floating events are seally only meaningful for personal things like 'eating breakfast' as per your example. never to be used for events that may be shared/viewed by people in different timezones as they will obviously not match up.
From https://www.rfc-editor.org/rfc/rfc5545
The date with local time form is simply a DATE-TIME value that
does not contain the UTC designator nor does it reference a time
zone. For example, the following represents January 18, 1998, at
11 PM: