Google Structured Data and Time Offset

Home Forums Calendar Products Events Calendar PRO Google Structured Data and Time Offset

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1288150
    Mathew
    Participant

    I’m researching and issue where an event is, for example, at 7:30 pm CST on a particular day. When doing a google search, the event is showing on the following day.

    When viewing the JSON-LD data, the timezone offset is not been set. It’s appending +00:00 on EVERY event.

    As a working example, visit your demo page and run it through the Google’s Testing Tool.

    The event is on 2017/05/11, but the startdate is 2017-05-12T01:00:00+00:00, which is partially correct, up to the offset. Google will show the event as Friday the 12th. See the attached screenshot from wpshindig’s testing results.

    I built a clean test site with Twenty Seventeen and the only the latest TEC plugins and was able to reproduce the issue. Even changing the WP timezone from Chicago to UTC-5 had no effect on the results.

    Here’s an article I found on the issue, but it went quiet.

    #1289136
    Neal
    Moderator

    Hey Matthew,

    Thanks for reaching out. Let’s see what’s going on with this timezone issue. You’re right, the timezone offset is showing +00:00 on google.

    Before we begin, can you confirm with me that you enabled timezone support in your Events Calendar? You can find it in Events > Settings in the General tab. We also have a guide here: https://theeventscalendar.com/knowledgebase/working-with-timezones/.

    If this was already enabled and you’re still seeing issues, can you share your system info with me? Also, if you have a site up that I can look at, that would be a great help!

    Cheers,
    Neal

    #1290075
    Mathew
    Participant

    Neal,

    I’ve tried all the various settings in TEC to no avail. However, I found this little gem and it resolved the issue. Thanks @nicosantos for the snippet!

    As I mentioned, the issue is present on the TEC demo site.

    #1290911
    Neal
    Moderator

    Hey Matthew,

    Awesome, I’m glad you found that snippet and it resolved your issue! I checked our bug log and I do see a bug similar to what you described. We are aware of it and are working on it.

    Thanks for looking out Matthew. Please let me know if you need anything else or have anymore questions.

    Cheers,
    Neal

    #1296013
    Mathew
    Participant

    After implementing Nico’s custom function, it had a negative effect on Google search results. I tweaked the function a bit and after a week, search results are now correct.

    Here’s what I came up with. The key is, and pass it along, using UTC with no offset.

    function tribe_modify_json_ld_event_dates ( $_data, $args, $event ) {

    $_data->startDate = date_create( tribe_get_start_date( $event->ID, true, Tribe__Date_Utils::DBDATETIMEFORMAT ) )->setTimezone( new DateTimeZone( 'UTC' ) )->format( 'c' );
    $_data->endDate = date_create( tribe_get_end_date( $event->ID, true, Tribe__Date_Utils::DBDATETIMEFORMAT ) )->setTimezone( new DateTimeZone( 'UTC' ) )->format( 'c' );

    return $_data;
    }
    add_filter( 'tribe_json_ld_event_object','tribe_modify_json_ld_event_dates', 10, 3 );

    #1297817
    Neal
    Moderator

    Hey Matthew,

    Awesome, thanks for sharing that snippet! I’m sure anyone looking for this will be able to reuse this.

    Cheers,
    Neal

    #1316866
    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

    #1374319
    Victor
    Keymaster

    Hey There!

    Just wanted to share with you that a new maintenance release (for the Week of 1st November 2017) is out, including a fix for this issue 🙂

    Find out more about this release → https://theeventscalendar.com/maintenance-release-for-the-week-of-1-november-2017/

    Please update the plugins and see if the fix works for your site. Don’t hesitate to open a new topic if anything comes up.

    Best,
    Victor

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Google Structured Data and Time Offset’ is closed to new replies.