• Resolved Eric Kuznacic

    (@kuznacic)


    My client has a TEC nonprofit license and is unable to post on the TEC website’s Support Forum, and we’re hoping someone here can help.

    They use TEC Pro and Event Tickets Plus, both the most updated versions. We have not yet upgraded to WP 4.5 due to a plugin compatibility question, but do not believe it is causing the issue described below.

    My client is having an issue in which the event date is correct on the single event page, but on the event archives page (list mode) the event date is one date into the future.

    The incorrect date only appears on the archives page in list mode; all dates are correct on the single event page.

    It does not appear to be a time zone issue, as both the WP setting and the TEC setting are Central/Chicago.

    To see an example, visit this page and look at the July 22 event. It is supposed to show July 21, as it does everywhere else in the single event page.

    Anyone have any ideas?

    https://www.ads-software.com/plugins/the-events-calendar/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter Eric Kuznacic

    (@kuznacic)

    As an update, this issue continues to hamper the site. It appears to only affect single items when viewed in list mode — AND — appears to surface only when an event is set to begin at 7PM local time or later.

    I believe this bug has to be affecting others — unless someone can show me why it would happen only for some events on one site?

    I followed both links and see the date for that event displaying as July 21 in both cases and there didn’t appear to be any other events starting at 7pm to compare against.

    So I’m not sure why you/your client appears to be seeing differently.

    Thread Starter Eric Kuznacic

    (@kuznacic)

    Sean, my apologies; my update should have included that we created an event to show correctly to the public (essentially by making it an all-day event) and did some testing with a private event not visible to non-logged -in users.

    I have made that private event public for now, if you are still willing to take a look. Here is the link. You will notice that the archives page shows it as 4/30 but everywhere else it is 4/29. If I change the event to begin at 6:30PM rather than 7PM, the archives page goes back to listing the correct date.

    Strange, eh? It may have something to do with setting the correct time zone, as we are UTC -5 during daylight saving time.

    What function is being used to create/populate the “event-date” div?

    My guess is that whatever calculates the date there is not doing so correctly and it seems like that date overlay on the image is not used on the single event view.

    Thread Starter Eric Kuznacic

    (@kuznacic)

    I am not fluent in PHP so this could be totally wrong, but here goes.

    I opened (the-events-calendar/src/functions/template-tags/date.php) and found where the date gets created.

    The functions used are tribe_get_start_time and tribe_get_end_time.

    There is mention, both in the start time and end time function, of using $timezone as a variable. However, that’s about as far as I can get.

    Here is the start time function (end time is almost identical). See anything of note here?

    function tribe_get_start_time( $event = null, $dateFormat = '', $timezone = null ) {
    		if ( is_null( $event ) ) {
    			global $post;
    			$event = $post;
    		}
    
    		if ( is_numeric( $event ) ) {
    			$event = get_post( $event );
    		}
    
    		if ( ! is_object( $event ) ) {
    			return;
    		}
    
    		if ( tribe_event_is_all_day( $event ) ) {
    			return;
    		}
    
    		$start_date = Tribe__Events__Timezones::event_start_timestamp( $event->ID, $timezone );
    
    		if ( '' == $dateFormat ) {
    			$dateFormat = tribe_get_time_format();
    		}
    
    		return tribe_format_date( $start_date, false, $dateFormat );
    	}
    }

    Is that code you wrote? It might be that it’s not quite handling the time/timezone as you expected.

    Whilst I haven’t tested it you might try a function like this instead:

    https://theeventscalendar.com/function/tribe_get_start_date/

    You can configure it to return rather than display the date and you could pass a format string that just returns the day.

    Hi. That function is from the core plugin: https://github.com/moderntribe/the-events-calendar/blob/4.1.2/src/functions/template-tags/date.php#L17

    I noticed the original link is a 404 but I found the event at https://www.rchs.us/event/night-at-the-museum/

    I saw it’s an all-day event (due to the apparent bug/issue), but to find which day it was displaying for, I went to https://www.rchs.us/events/month/ (manually added month/) and it displayed a blank white page with this error:

    Warning: mysql_num_fields() expects parameter 1 to be resource, boolean given in /wp-includes/wp-db.php on line 3018

    So you might want to look into that.

    I’d suggest you change the event back to non-all-day and check the box to “Show timezone”
    Also, please specify if your WordPress time zone or this event’s time zone is set to “Chicago” or if it’s set to “UTC-6”

    If nothing valuable turns up from that, please follow our Testing for Conflicts Guide?and see if that helps narrow down the cause of this.

    I hope it gets figured out!

    Thread Starter Eric Kuznacic

    (@kuznacic)

    My apologies for the late reply, and thanks to those who are providing advice and assistance.

    I went in and found the error on the “month” view that Clifford mentioned. It appears to only occur when the user is not logged into the site, and appears to be separate from TEC Pro.

    As mentioned in the OP the time zone settings for both WP and TEC Pro were set to Central/Chicago time. I did go in and refresh the time zone settings and allow them to show on the events, but the issue persists.

    I also set the “end of day cutoff” option to 5 a.m. to see if it would change anything. It did not.

    I will test for conflicts with other plugins, but I am not optimistic. It seems to me that something in TEC Pro is not handling the time zone correctly. If my client’s license allowed I would post this issue on the official support forum.

    I am not going to mark this as resolved at this time, but the WP.org moderators may do so if they see fit. I am still open to assistance and suggestions on how to fix this issue. Thanks!

    Hey Eric,

    Just chiming in here.
    As my colleague Cliff suggested, going through the testing for conflicts procedure is always a good idea. At least it lets us rule out certain potential causes.

    As a side note, I have also seen cases where similar issues where caused by:
    – The server time being off
    – The Recurring event instances checkbox being checked in Events -> Settings -> General which was incompatible with template customizations such as yours

    Let us know what you find out

    Best regards,
    Geoff B.

    Thread Starter Eric Kuznacic

    (@kuznacic)

    Just to close out this topic — my best guess is that the issue was caused by the server time being off. The host denied this on several occasions, but the issue resolved itself once the host migrated all his sites from shared to cloud hosting. Thanks to everyone who offered advice and assistance, and thanks to Geoff for suggesting the server time issue. Great plugins and support!

    Brook

    (@brook-tribe)

    Very interesting. Thank you for getting back Eric. It was our pleasure to assist.

    Cheers!
    – Brook

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Event date on archive page is one day off’ is closed to new replies.