RSS Feed – Time showing incorrectly.

Home Forums Calendar Products Events Calendar PRO RSS Feed – Time showing incorrectly.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #607563
    Micha McLain
    Participant

    Hello. I’m trying to use mail chimp to do a monthly feed of upcoming events. I got the email configured right and everything is ready to go. Except, when I preview, the time of day that the email shows is different that the published time on the website. It’s showing like 3 hours off.

    I’m thinking it may be due to the servers physical location being different, but I don’t know.

    How can I fix this?

    #638596
    Barry
    Member

    Hi teammultiverse,

    Looks like a possible oversight on our part; can you test out the code below (by adding it to your theme’s functions.php file) and see if that helps here?

    add_filter( 'get_post_time', 'events_rss2_gmt_pubdate_correction', 20 , 3 );
    
    function events_rss2_gmt_pubdate_correction($time, $d, $gmt) {
    	global $post;
    
    	// Don't interfere if this is not the events feed
    	if ( $post->post_type != TribeEvents::POSTTYPE || ! is_feed() || ! $gmt ) return $time;
    
    	// Don't interfere if the timezone hasn't been set
    	$zone = get_option( 'timezone_string', false );
    	if ( false === $zone ) return $time;
    
    	// Get time and timezone
    	$time = new DateTime( tribe_get_start_date( $post->ID, false, $d ) );
    	$zone = new DateTimeZone( $zone );
    
    	// Apply timezone and calculate offset
    	$time->setTimezone( $zone );
    	$offset = $zone->getOffset( $time );
    	$offset *= -2;
    
    	// Apply correction
    	$time->modify( "$offset seconds" );
    	$time = $time->format( TribeDateUtils::DBDATETIMEFORMAT );
    	$time = mysql2date( $d, $time );
    
    	return $time;
    }
    #639181
    Micha McLain
    Participant

    Hey. That did the trick. Thanks very much.

    Is this something you will write into the next update? I’m just wondering if I need to leave this code in my functions file permanently or not.

    Thanks again.

    #641354
    Barry
    Member

    Awesome, glad that worked for you 🙂

    Is this something you will write into the next update? I’m just wondering if I need to leave this code in my functions file permanently or not.

    I’ve logged this as a bug so we’ll definitely do our best to address it in a future release. What we try to do is come back and post an update in threads like this one, so if you continue to monitor this thread you should be kept informed of progress and can remove the snippet at the appropriate time.

    Of course, if for any reason we forget to update this thread and you find a future version causes a new displacement of times in the RSS feed that would indicate that a fix was added and you need to strip out the snippet – but we’ll do our best to avoid that by providing an update here in this thread.

    Until we’re ready to post that update – which realistically might be a couple of months away – I’ll close the thread, unless you have any other questions in the interim?

    #723498
    Barry
    Member

    Hi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!

    #769041
    Leah
    Member

    Hi there,

    Thanks for bringing this issue to our attention. We weren’t able to get to it for our upcoming 3.8 release, but it is still very much on the radar. We hope to have it fixed in an upcoming release, and we will do our best to keep you posted on our progress. Thanks for your patience and support!

    Best,
    Leah
    and the team at Modern Tribe

    #988055
    Leah
    Member

    Hello,

    Thank you again for bringing this issue to our attention. We’re happy to say that we have added a fix for this into our upcoming version 3.11 release. Keep an eye on your Updates page for the new version. If you have any trouble with the update (or are still seeing this problem after you update) please start a new thread and we’d be happy to help out.

    Thank you for your patience while we got this release ready to go!

    Best,
    Leah
    and the rest of The Events Calendar team

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘RSS Feed – Time showing incorrectly.’ is closed to new replies.