Author Topic: Import of ical from CiviEvent to Google Time Sync Error  (Read 1737 times)

projectgetreal

  • Guest
Import of ical from CiviEvent to Google Time Sync Error
« on: July 27, 2009, 07:48:37 pm »
When I try to import an ics file to Google Calendar from CiviEvent, the time is 5 hours off.  Both the time zones are set to the same (Central Time).  Why is this happening?  I need to make sure that  the times are correct so that my staff can just create the event and import it to our Google Calendar.  Please advise.

Jacob

winn

  • Guest
Re: Import of ical from CiviEvent to Google Time Sync Error
« Reply #1 on: September 28, 2009, 01:18:20 pm »
I am experiencing the same issue, except my offset is -7. The google calendar can be found here: http://rmfi.org/calendar, and the civiCRM calendar can be found here: http://rmfi.org/rmfi-events.ics.

Any insights would be greatly appreciated.

-Winn

Online Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5725
  • Karma: 226
    • My CiviCRM Blog
Re: Import of ical from CiviEvent to Google Time Sync Error
« Reply #2 on: September 29, 2009, 10:43:24 am »
Winn - I don't think we've had success (yet) with Google calendar / ics integration. We're passing a valid "local time" as far as i know - but Google seems to be interpreting it as UTC with no offset.

The relevant ical doc from this page -  http://www.ietf.org/rfc/rfc2445.txt - is:
----
FORM #1: DATE WITH LOCAL TIME

   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 Janurary 18, 1998, at 11 PM:

     DTSTART:19980118T230000
---

You can potentially try experimenting with modifications of the ics file and see if you can get the correct result. If so, post back (with a patch if possible), or just let us know what worked and we'll see if we can incorporate a fix for a future version. You can either modify the .ics file directly, or modify the template which formats it: templates/CRM/Core/Calendar/ICal.tpl
Protect your investment in CiviCRM by  becoming a Member!

winn

  • Guest
Re: Import of ical from CiviEvent to Google Time Sync Error
« Reply #3 on: October 01, 2009, 01:01:33 pm »
Ok, I've solved the time difference issue, but I need a bit of help implementing it. The problem is that while the calendar is displaying local time, it doesn't convey which time zone that is.

Inserting the following line into templates/CRM/Core/Calendar/ICal.tpl fixes the problem. How do I find out what the correct variable is for timezone so that it will work for everyone who doesn't reside in the US/Mountain time zone?

X-WR-TIMEZONE:US/Mountain

Also, does anyone know how often/if google updates its calendars?

Online Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5725
  • Karma: 226
    • My CiviCRM Blog
Re: Import of ical from CiviEvent to Google Time Sync Error
« Reply #4 on: October 01, 2009, 02:28:09 pm »
You can use PHP's date function (with 'e' or 'T' parameter) to return full or abbreviated timezones. Not sure if format is acceptable to Google / iCal?
http://www.php.net/manual/en/function.date.php
http://www.php.net/manual/en/function.date-default-timezone-get.php

I haven't tried this specific function - but in general you can use PHP functions in the smart templates as "modifiers" - so you might be able to do this strictly in the .tpl file.

http://www.smarty.net/manual/en/language.modifiers.php

Note the rules PHP uses to determine the timezone. If your server is not in your timezone, you might not get expected results.

Not sure what you mean by this ... "so that it will work for everyone who doesn't reside in the US/Mountain time zone?" If the timezone is included, hopefully the client-side apps (Outlook or Google calendar or ...) take care of conversions that might be needed (e.g. for web-based events where a person wants to know what time the event is occurring "in their own timezone").

Warning - I'm not an expert on all the "angles" of timezone handling - so take all above w/ grain of salt.
Protect your investment in CiviCRM by  becoming a Member!