In my defense I will say that I searched for 2 hours on this site for the answer, but I would like to profusely apologize for posting this again if it is in fact a duplication.

I have setup Date API, Views, and Calendar in hopes of importing several iCal into a calendar. It works beautifully! Except for the times on the events in calendar and list are displaying in UTC.

I did read somewhere that you need to setup CCK to do offset, but it was doing the UTC thing before I tried to install CCK (I have since disabled it and am only running Date API).

There is probably something simple I'm missing. Thank you so much for all your help.

Comments

raintonr’s picture

I, too am completely confused by timezone issues. There is no problem when time related data is confined to the site itself, but when trying to export iCal (so users can show our node times in Thunderbird/Lightening for example) I simply cannot get this to work.

Setup is this:

- Server is Linux box in Australia/Sydney zone (/etc/localtime -> /usr/share/zoneinfo/Australia/Sydney)
- Date 5.x-1.7
- In our CCK content type there is a timestamp field.

If one sets the CCK "Time zone handling" field to "No time zone conversion" then things work nicely within the site. This is what we've been using. I found because of daylight savings time (DST) that if one uses "Site's time zone" here then when DST is in effect and one enters an event outside of the DST period that it looks fine to begin, but then is offset by one hour when the DST period ends. It is for this reason I left the CCK field "No time zone conversion".

With this "No time zone conversion", times appear to be stored in the DB as entered yet exported in iCal without any associated zone info, so in our case are currently 11 hours behind what they should be in external applications.

I haven't looked too deeply into the code but this would appear to be because the admin/settings/date-time page one can only specify the timezone relative to GMT/UTC and not a particular, known zone with known DST periods.

I'm sorry, but in order for iCal import/export to work this seems like a glaring hole. Why is it that the date module does have code that appears to know when DST periods start and end and yet the admin/settings/date-time page cannot make use of this?

Or am I just completely stupid and have missed something?

raintonr’s picture

I've managed to get iCal export to work as desired by performing a horrible cludge as follows:

- Include a BEGIN:VTIMEZONE section in the export before any events, hardcoded to our server's location (Sydney Australia).
- Where a TZID would otherwise not be appended, include the default ID.

This was put in the date_api_ical.inc file, date_ical_export function by inserting this before the events loop:

  $def_tzid = '/drupal.org/Australia/Sydney';
  $output .= <<<EOF
BEGIN:VTIMEZONE
TZID:$def_tzid
X-LIC-LOCATION:Australia/Sydney
BEGIN:DAYLIGHT
TZOFFSETFROM:+1000
TZOFFSETTO:+1100
TZNAME:EST
DTSTART:19701025T020000
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+1000
TZOFFSETTO:+1000
TZNAME:EST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
END:STANDARD
END:VTIMEZONE

EOF;

Then changing the following within the events loop:

//OLD        $output .= "DTSTART;VALUE=DATE-TIME:". gmdate("Ymd\THis", $event['start']) .$tz_append ."\n";
        $output .= "DTSTART;TZID=$def_tzid:". gmdate("Ymd\THis", $event['start']) .$tz_append ."\n";
//OLD          $output .= "DTEND;VALUE=DATE-TIME:". gmdate("Ymd\THis", $event['end']) .$tz_append ."\n";
          $output .= "DTEND;TZID=$def_tzid:". gmdate("Ymd\THis", $event['end']) .$tz_append ."\n";

Of course, to do this properly one would derive the $def_tzid and associated export from site settings, etc.

This works for us, but I'd rather not leave it as of course it will not be compatible with future upgrades, anyone want to take this idea further and incorporate into the module base?

KarenS’s picture

Title: YATZI (Yet Another TimeZone Issue) » Timezone info not displayed in iCal link
Version: 5.x-1.x-dev » 7.x-1.x-dev

The original version of the iCal code shows the GMT date for all events. Doing this better requires some improvements to the iCal code, which are going into the Data API version 2 and will go into a version 2 of the Calendar module.

Moving this to HEAD to indicate where this will get fixed.

KarenS’s picture

Status: Active » Fixed

This should be fixed in the 5.2 version, which is not quite ready for an official release. You can see that release if you look for 'other releases' on the project page. Try it in a test environment, or be prepared to update it as bugs are found and fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.