Outlook 将 iCalendar UTC 日期/时间视为重复事件的浮动日期/时间

发布于 2024-11-20 00:14:40 字数 1351 浏览 5 评论 0原文

我正在根据基于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

网名女生简单气质 2024-11-27 00:14:40

我正在阅读 iCalendar 规范,发现这个小段落

“DTSTART”和“DTEND”属性对或“DTSTART”和“DURATION”
在 iCalendar 对象中指定的属性对定义了第一个
重现的实例。当与递归规则一起使用时,
“DTSTART”和“DTEND”属性必须在本地时间中指定,并且
适当的“VTIMEZONE”日历组件集必须是
包括。有关“VTIMEZONE”日历的使用详细信息
组件,请参阅“VTIMEZONE”日历组件定义。

我能够使用 date_default_timezone_get() 像这样:

$data[] = 'DTSTART;TZID=' . date_default_timezone_get()
        . ':' . $date_start;

简单地进行更改就可以解决问题,但我的 ics 文件不符合 iCalendar 标准,因为我不知道如何根据该值生成“VTIMEZONE”日历组件从date_default_timezone_get()

I was reading the iCalendar spec, and found this little paragraph:

The "DTSTART" and "DTEND" property pair or "DTSTART" and "DURATION"
property pair, specified within the iCalendar object defines the first
instance of the recurrence. When used with a recurrence rule, the
"DTSTART" and "DTEND" properties MUST be specified in local time and
the appropriate set of "VTIMEZONE" calendar components MUST be
included. For detail on the usage of the "VTIMEZONE" calendar
component, see the "VTIMEZONE" calendar component definition.

I was able to use date_default_timezone_get() like this:

$data[] = 'DTSTART;TZID=' . date_default_timezone_get()
        . ':' . $date_start;

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 from date_default_timezone_get().

北方。的韩爷 2024-11-27 00:14:40

Z 后缀表示 UTC 时区,而不是“浮动”

对于 DTSTART 和 DTEND,请关闭 Z。然后严格来说日历应用程序应该使用自己的时区加载它。

浮动事件仅对个人事物有意义,例如按照您的示例“吃早餐”。切勿用于可能由不同时区的人共享/查看的事件,因为它们显然不匹配。

来自 https://www.rfc-editor.org/rfc/rfc5545

日期本地时间形式只是一个日期时间值
不包含 UTC 指示符,也不引用时间
区。例如,以下表示 1998 年 1 月 18 日
晚上 11 点:

   19980118T230000

  DATE-TIME values of this type are said to be "floating" and are
  not bound to any time zone in particular.  They are used to
  represent the same hour, minute, and second value regardless of
  which time zone is currently being observed.  For example, an
  event can be defined that indicates that an individual will be
  busy from 11:00 AM to 1:00 PM every day, no matter which time zone
  the person is in. 

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:

   19980118T230000

  DATE-TIME values of this type are said to be "floating" and are
  not bound to any time zone in particular.  They are used to
  represent the same hour, minute, and second value regardless of
  which time zone is currently being observed.  For example, an
  event can be defined that indicates that an individual will be
  busy from 11:00 AM to 1:00 PM every day, no matter which time zone
  the person is in. 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文