1.6 All Day Events and Time Zones

GroupWise all day events can cause problems if applications need to apply the sender's time zone to the start and end dates.

Problem

An application displays an all day event on the wrong day.

Solution

GroupWise clients set the startDate and endDate to midnight of the user's time zone. As the item is saved to the user's database, all times are converted to UTC. This causes problems in determining the actual date of the all day event because the date and time on the event shifts. The shift depends the time zone of the GroupWise clients.

As an example, suppose a GroupWise client sends an all day event on 9/26/2012 with a time zone of Mountain Daylight Time. The output for this all day event is as follows:

<getItemResponse>
<item type="Appointment">
...
<subject>All Day Event</subject>
<startDate>2012-09-26T06:00:00Z</startDate>
<endDate>2012-09-27T06:00:00Z</endDate>
<startDay>2012-09-26</startDay>
<endDay>2012-09-27</endDay>
<allDayEvent>1</allDayEvent>
<timezone>
<daylight>
<name>Mountain Daylight Time</name>
<month>4</month>
<dayOfWeek occurrence="First">Sunday</dayOfWeek>
<hour>2</hour>
<minute>0</minute>
<offset>-21600</offset>
</daylight>
<standard>
<name>Mountain Standard Time</name>
<month>10</month>
<dayOfWeek occurrence="Last">Sunday</dayOfWeek>
<hour>2</hour>
<minute>0</minute>
<offset>-25200</offset>
</standard>
</timezone>
</item>

In the output above, the startDate has a value of <startDate>2012-09-26T06:00:00Z</startDate>. The time is 6:00 a.m. because GroupWise saves the time in UTC. UTC is 6 hours ahead of MDT in our example.

In order to determine the real date of the all day event, you need to change the startDate and endDate to midnight by using a time zone to represent the sender’s time zone. An application adds the sender’s time zone offset to the startDate and endDate values.

Using the example above, this appears as follows:

<startDate>2012-09-26T06:00:00Z</startDate> + <offset>-21600</offset> = <startDate>2012-09-26T00:00:00Z</startDate>

The adjusted startDate is midnight. The endDate needs the same adjustment.

AllDayEvents returns a startDate, startDay, endDate, and endDay. The startDate and endDate have times associated with the dates, as follows:

<startDate>2012-09-26T06:00:00Z</startDate>

StartDay and endDay do not have time associated with the dates:

 <startDay>2012-09-26</startDay>

Use the elements that don't return a time. If an all day event does not interact with other GroupWise or third-party clients, the startDay and endDay elements can be used. Otherwise, you need to use the adjusted startDate and endDate elements.