Jump to:

10994 Posts in 2728 Topics by 1819 members

All other Modules

SilverStripe Forums » All other Modules » Event Calendar - Google .ics import - Time Issues

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 7969 Views
  • jseth
    Community Member
    98 Posts

    Re: Event Calendar - Google .ics import - Time Issues Link to this post

    To import an .ics, follow this link and read Uncle Cheese's post about ICS Feeds.

  • kiwiot
    Community Member
    8 Posts

    Re: Event Calendar - Google .ics import - Time Issues Link to this post

    I've had the same problem with timezones when importing a google ics. I tried coffeymachine's function which worked to some extent but meant that times were always shown even if the event was a full or multi-day event so I decided to write my own little hack by reformatting the original string.

    I also came across a second issue. Google marks a full day event by an end date of the next day which in effect was causing my dates to show a day extra.

    + checks to see if the date is full/multiday and adjusts the end time by one day.
    + adds ability to offset timezone for events with times associated.

    In event_calendar/code/CalendarUtil.php line 153 add the extra code to the function date_info_from_ics:

        public static function date_info_from_ics($dtstart, $dtend)
          $start_date = null;
          $end_date = null;
          $start_time = null;
          $end_time = null;
          /* Google Calendar ICS date hacks for timezone settings and full day events */

          $fulldaytest = explode("T",$dtstart);
             $dtend = date('Ymd', strtotime($dtend.'-24 hours'));   
          else {
             $myOffset = '+9 hours'; // manual offset for Korea
             $startTimestamp = strtotime($dtstart.$myOffset);
             $dtstart = date('Ymd', $startTimestamp)."T".date('His', $startTimestamp)."Z";
             $endTimestamp = strtotime($dtend.$myOffset);
             $dtend = date('Ymd', $endTimestamp)."T".date('His', $endTimestamp)."Z";
          /* END Google ICS hack */
          ..... rest is the same as original function

    Not too pretty but it'll do the job for now and I have not tested this thoroughly - so use at your own risk.

    Hope this helps anyone else out there or at least puts you on the right track.


  • SerenityIT
    Community Member
    13 Posts

    Re: Event Calendar - Google .ics import - Time Issues Link to this post

    Can't import any kind of ics into the calendar... It causes the page to go to error 500.

Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.