Time in iCal feed

Home Forums Calendar Products Events Calendar PRO Time in iCal feed

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1164723
    twkmedia
    Participant

    Hi Support,

    We use Events Calendar pro on one of our sites, and this event: http://hamptonprep.org.uk/event/headmasters-briefing-11-process-year-6-parents-followed-cheese-wine/

    Shows the correct time on the site, but in the iCal feed (attached) it is two hours out in feed compared to on the site. Since we’re in BST +1 this makes it one hour out when you have added feed to system e.g. Google Calendar, Apple Calendar etc.

    In feed attached search for: 20160915T18 and you will find the event.

    Do you know what the issue is here?

    Thanks

    Ben

    #1164954
    Hunter
    Moderator

    Hey Ben,

    Can you reply back with the iCal url (from Google) and your System Information as a private reply? I’d be happy to try and reproduce the issue.

    Have a great night. Cheers 🙂

    #1164999
    twkmedia
    Participant

    This reply is private.

    #1165570
    Hunter
    Moderator

    Welcome back!

    Before we go too much further, can you please clarify whether the .ics feed with incorrect times is being “exported” from your WordPress website or from Google Calendar? Better yet, break down the process you’re attempting in step-by-step instructions and I’ll do my best to reproduce the issue. Also, if you haven’t already, please review our Testing for conflicts guide to ensure a theme and/or plugin conflict is not in play.

    Thank you for the response and enjoy the rest of your weekend. Cheers!

    #1165772
    twkmedia
    Participant

    Hi Hunter,

    These are the steps we are following when we find this issue: http://hamptonprep.org.uk/whats-on/calendar-subscribe/

    Specifically the first set of APPLE ICAL INSTRUCTIONS.

    Thanks

    Ben

    #1166038
    Hunter
    Moderator

    Hey Ben,

    Thank you for sending that over. I hate to ask, but are you able to set up a test domain and test as required in our Testing for conflicts guide to see if you can replicate the issue? Let me know if that’s doable and if so, what the results are.

    Thank you again for working with me on the issue and rest assured, if there’s a bug, we’ll find it! Have a great afternoon. Cheers 🙂

    #1166527
    twkmedia
    Participant

    Hi Hunter,

    Surely this kind of issue isn’t going to be a conflict with another plugin or anything like that? A conflict might break something but it wouldn’t just throw all the calendar events in the ical feed out by a couple of hours?!

    Thanks

    Ben

    #1167064
    Hunter
    Moderator

    Hey Ben,

    Unfortunately these types of issues can definitely be related to another plugin conflict. I’ve imported your calendar into my Apple Calendars app and the start/end times are off, so this last test will determine where we go from here. I’ve brought this thread to the attention of other support team members with more experience in these instances, so let me know what you find and we’ll continue investigating from there.

    I truly apologize if it seems redundant and unnecessary to set up the test domain, but it’s always recommended to have a testing environment for these scenarios. Thanks for understanding and I look forward to your response.

    #1167170
    twkmedia
    Participant

    Hi Hunter,

    We’ve managed to fix this ourselves but only by hacking the core plugin. First we found a safe way to add the timezone to the feed using filters:

    add_filter( ‘tribe_ical_properties’, __NAMESPACE__ . ‘\\add_ical_timezone’ );
    function add_ical_timezone( $content ) {
    $content .= “X-WR-TIMEZONE:Europe/London\r\n”;
    $content .= “TZID:Europe/London\r\n”;
    return $content;
    }

    And this works slightly. It bumps the time so that it is only one hour out!

    Then we edited a core file () and changed this function:

    private static function wp_strtotime( $string ) {
    // If there’s a timezone specified, we shouldn’t convert it
    try {
    $test_date = new DateTime( $string );
    if ( ‘UTC’ != $test_date->getTimezone()->getName() ) {
    return strtotime( $string );
    }
    } catch ( Exception $e ) {
    return strtotime( $string );
    }
    $tz = get_option( ‘timezone_string’ );
    if ( ! empty( $tz ) ) {
    $date = date_create( $string, new DateTimeZone( $tz ) );
    if ( ! $date ) {
    return strtotime( $string );
    }
    $date->setTimezone( new DateTimeZone( ‘UTC’ ) );
    return $date->format( ‘U’ );
    } else {
    $offset = (float) get_option( ‘gmt_offset’ );
    $seconds = intval( $offset * HOUR_IN_SECONDS );
    $timestamp = strtotime( $string ) – $seconds;
    return $timestamp;
    }
    }

    So that it no longer adjusts the time for timezone, and just returns the time in it’s original format.

    From what we can tell $test_date->getTimezone()->getName() is returning UTC when it shouldn’t be.

    On the basis that if we update the plugin this fixed will be lost, I wonder why we pay for the Events Calendar PRO?

    Thanks

    Ben

    #1167744
    George
    Participant

    Hey Ben,

    Thanks for sharing your code workaround here.

    If you modify core plugin code, you are correct that the code will be overwritten the next time the plugin itself is updated. However, since your custom code is using a filter, you should be able to place this filter in your theme’s functions.php file or in a custom plugin of your own and it will NOT be lost upon an update of Events Calendar Pro.


    Now, in regards to the actual issues here, what you are reporting with your iCal feeds is not a known bug. There may be some simple configuration options on your site that are causing the mismatched times.

    One of the main reasons folks pay for Events Calendar PRO or any of our premium add-ons is for the customer support. I understand that you might be frustrated at this point, but Hunter’s questions above are actually important because, like I mentioned, there is not a known bug here and we want to make sure that we rule out a bug (or unearth one so that we can fix it!)

    Would you like to proceed with the support process here? If you’re happy with your code solution for now, and want to close the topic, that’s fine. But Hunter and I are both looking into the time-shift with your iCal feeds and are happy to continue doing so.

    With all that being said, if you DO want to continue on the support process here:

    1. Can you temporarily remove the “fix” code you posted here? Make a backup of this code, of course, so that you can re-add it if need be. But for now—temporarily—remove it.

    2. Can you please confirm how this /subscribe.ics URL is generated? Just curious—this URL is generating the same ICS data as the “Export Month’s Events” link on the actual /calendar/ page, so I’m not saying there’s a problem here. Just curious about how this /subscribe.ics URL is being generated on your site.

    3. Once you’ve removed the code, what do you find if head to Settings → General in your site’s wp-admin and temporarily set the timezone to UTC+0? Once you do this, try importing ICS events and let us know what you find.

    Thanks,
    George

    #1176656
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Time in iCal feed’ is closed to new replies.