开发者

Outlook Treating iCalendar UTC Date/Time as Floating for Recurring Events

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开发者_如何学JAVA 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:EVENT-91@WWW.DOMAIN.COM
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:EVENT-82@WWW.DOMAIN.COM
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.


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


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. 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜