Today's Date on Calendar is showing wrong day!

Home Forums Calendar Products Events Calendar PRO Today's Date on Calendar is showing wrong day!

Viewing 15 posts - 1 through 15 (of 32 total)
  • Author
    Posts
  • #984928
    James
    Participant

    Hi Guys/Gals,

    I just noticed that the highlighted day representing today’s date on the calendar is showing yesterday as the current day.

    I have set the timezone to +10 hrs GMT in WordPress, as I’m located in Australia.

    Any idea as to how to have it show the current day? I have noticed that late on our day it does switch over to show the current day.

    Thanks

    James

    #984982
    Geoff
    Member

    Hey there, James! Welcome back to the forums–nice to see you again. 🙂

    That’s certainly odd. By chance, does the same issue happen if you select a city in the WordPress timezone settings instead of a UTC time? For example, if Sydney is the nearest city to you, then try selecting that one in Settings > General and see if the same thing continues to happen.

    Let’s start there and see what we find.

    Cheers!
    Geoff

    #985227
    James
    Participant

    Hi Geoff,

    I didn’t even noticed that you could select actual cities, you learn something new every day! 🙂

    Ok I changed the WordPress timezone setting to Brisbane, where I live and it is still one day behind. I cleared all the caches and turned off all plugins just to see if it made a difference.

    Cheers
    James

    #985294
    Geoff
    Member

    Shoot, I was hoping that might do the trick but thanks for giving it a shot! I definitely appreciate you clearing your cache and deactivating your plugins for good measure. 🙂

    Do events display on the incorrect day only when the current day is highlighted? So, for example, does an event display on the correct day until it gets to close to the current day, then it moves dates? Or are events always displayed on the incorrect dates, regardless of whether it is the current date or not?

    We’ll get the to bottom of this!

    Thanks,
    Geoff

    #985507
    James
    Participant

    Hi Geoff,

    Everything works fine, events display on the right day etc. It’s only the little highlighted bar which indicates the current day, that is lagging behind. I did notice yesterday, come midday (my time) it did switch over to the actual current day.

    You can see what I mean at https://www.jamesdoylephoto.com/activities-calendar/

    Cheers

    James

    #985567
    Geoff
    Member

    Oh, interesting!

    Do you happen to have any other timezone settings on your site–perhaps something that’s included with the theme or another installed plugin? Just want to make sure nothing is conflicting there, though I do see you noted having already tried switching to a default WordPress theme and deactivating other plugins.

    Also, try checking the day cutoff time in your calendar settings. You can find this in Events > Settings in the General Settings section of the page. Is it set to something other than 12:00am?

    Thanks!
    Geoff

    #985734
    James
    Participant

    Hi Geoff,

    Well I did some exploring throughout all the settings and I am suspecting it’s something to do with how wordpress applies the GMT offset. I say that because I was watching the event calendar at 10am my local time eg GMT +10 and as soon as it turned 10 am the “current day” on the calendar switched to the correct day.

    In the database, options table, there is an entry of “gmt_offset” but it is blank and even if I enter +10 or brisbane it doesn’t save. I’m not sure if this is anything to do with why the calendar is at GMT and not local current time.

    It is interesting that everywhere else the time and date is correct and in the WordPress general setting it is set to Brisbane.

    I hope this information might lead you Geoff to think of a solution. 🙂

    Cheers
    James

    #985779
    Geoff
    Member

    Thanks for the additional info, James! I really appreciate it. 🙂

    Just to check the question I had for you off the list:

    Also, try checking the day cutoff time in your calendar settings. You can find this in Events > Settings in the General Settings section of the page. Is it set to something other than 12:00am?

    Is that setting at 12:00am or is it set to some other time perchance?

    Thanks!
    Geoff

    #986065
    James
    Participant

    Hi Geoff,

    Sorry for the delay in getting back to you, I was out in the field all yesterday, chasing snow! A rare event here in sunny queensland!

    Yes, the cutoff time in your calendar settings is set to 12am.

    Cheers

    James

    #986200
    Geoff
    Member

    Thanks James! I’m going to look at this with someone else on the team here to see if we can come up with any other ideas for you here.

    Thanks for your patience and I’ll follow up again shortly. 🙂

    Geoff

    #986225
    Geoff
    Member

    Hi James,

    OK, looking at this a little deeper. 🙂

    Do you happen to have any customizations in place. For example, if you go to your theme directory, do you see a folder called tribe-events? Or have you made modifications directly to the Month View template? Or perhaps any functions that target Month View?

    The reason I ask is because the Month View layout on your site looks different from the one that ships with the plugin by default.

    Cheers!
    Geoff

    #986420
    James
    Participant

    Morning Geoff,

    I have three modified files in the theme folder for “month”, each are snippets from the EC website.

    I’m not too sure how to upload them here so I’m attaching links to each file as they are on my website server.

    1. https://www.jamesdoylephoto.com/month/nav.php

    2. https://www.jamesdoylephoto.com/month/single-event.php

    3. https://www.jamesdoylephoto.com/month/tooltip.php

    Hope this helps!

    Cheers

    James

    #986429
    James
    Participant

    Sorry Geoff,

    I can’t seem to give you access to the files on the server so I’ll copy them here.

    nav.php

    <?php
    /**
    * Month View Nav Template
    * This file loads the month view navigation.
    *
    * Override this template in your own theme by creating a file at [your-theme]/tribe-events/month/nav.php
    *
    * @package TribeEventsCalendar
    *
    */

    if ( ! defined( ‘ABSPATH’ ) ) {
    die( ‘-1’ );
    } ?>

    <?php do_action( ‘tribe_events_before_nav’ ) ?>

    <h3 class=”tribe-events-visuallyhidden”><?php _e( ‘Calendar Month Navigation’, ‘tribe-events-calendar’ ) ?></h3>

    <ul class=”tribe-events-sub-nav”>
    <li class=”tribe-events-nav-previous”>
    <?php tribe_events_the_previous_month_link(); ?>

    <?php if ( date_i18n( ‘Y-m-01’ ) !== tribe_get_month_view_date() ): ?>
    <li class=”tribe-events-nav-current”>
    getLink( ‘month’ ) ?>”>Back to Current Month

    <?php endif ?>

    <!– .tribe-events-nav-previous –>
    <li class=”tribe-events-nav-next”>
    <?php tribe_events_the_next_month_link(); ?>

    <!– .tribe-events-nav-next –>
    <!– .tribe-events-sub-nav –>

    <?php do_action( ‘tribe_events_after_nav’ ) ?>

    **************************************************************************************************

    single-event.php

    <?php
    /**
    * Month Single Event
    * This file contains one event in the month view
    *
    * Override this template in your own theme by creating a file at [your-theme]/tribe-events/month/single-event.php
    *
    * @package TribeEventsCalendar
    *
    */

    if ( ! defined( ‘ABSPATH’ ) ) {
    die( ‘-1’ );
    } ?>

    <?php
    global $post;
    $day = tribe_events_get_current_month_day();
    $event_id = “{$post->ID}-{$day[‘daynum’]}”;
    $start = tribe_get_start_date( $post, false, ‘U’ );
    $end = tribe_get_end_date( $post, false, ‘U’ );

    ?>

    <div id=”tribe-events-event-<?php echo $event_id ?>” class=”<?php tribe_events_event_classes() ?>” data-tribejson='<?php echo tribe_events_template_data( $post ); ?>’>
    <h3 class=”tribe-events-month-event-title entry-title summary”>” class=”url”><?php the_title() ?></h3>
    <?php if (has_post_thumbnail() && 1 === $day[‘total_events’]) : ?>
    <div class=”tribe-events-event-thumb”><?php echo the_post_thumbnail(array(130,130));?></div>
    <?php endif; ?>
    </div><!– #tribe-events-event-# –>
    <!–Event Availability–>
    <?php if ( tribe_events_has_soldout() ): ?>
    <span class=”tickets-sold-out”>
    Bookings Closed
    </span>
    <?php elseif ( tribe_events_has_tickets() ): ?>
    <span class=”tickets-in-stock”>
    Bookings Available
    </span>
    <?php endif ?>

    *********************************************************************************************************

    tooltip.php

    <?php

    /**
    *
    * Please see single-event.php in this directory for detailed instructions on how to use and modify these templates.
    *
    */

    ?>

    <script type=”text/html” id=”tribe_tmpl_tooltip”>
    <div id=”tribe-events-tooltip-[[=eventId]]” class=”tribe-events-tooltip”>
    <h4 class=”entry-title summary”>[[=title]]</h4>

    <div class=”tribe-events-event-body”>
    <div class=”duration”>
    <abbr class=”tribe-events-abbr updated published dtstart”>[[=startTime]] </abbr>
    [[ if(endTime.length) { ]]
    -<abbr class=”tribe-events-abbr dtend”> [[=endTime]]</abbr>
    [[ } ]]
    </div>
    [[ if(imageTooltipSrc.length) { ]]
    <div class=”tribe-events-event-thumb”>
    [[=title]]
    </div>
    [[ } ]]
    [[ if(excerpt.length) { ]]
    <p class=”entry-summary description”>[[=raw excerpt]]</p>
    [[ } ]]
    <span class=”tribe-events-arrow”></span>
    Find out more
    </div>
    </div>
    </script>

    #986807
    Brook
    Participant

    Hey James!

    I am helping assist folks in Geoff’s stead today, he is traveling at the moment.

    Thank you for sharing those files. I am not seeing anything in the customizations that looks like it would be a problem.

    It sounds like you definitely have a timezone issue, considering mid day it changes to the proper day. In reading through this I had one idea on what might be causing the problem which we have not looked into yet. We fairly commonly see plugin and theme authors use the PHP function date_default_timezone_set(). Unfortunately in WordPress it is a terrible idea to use this function. That is because WordPress itself purposefully sets date_default_timezone_set() to give all plugins a baseline to calculate timezones against. If one plugin changes it, it can break every other plugins timezone settings on the website. But, many authors do not realize they are breaking WordPress when they play with this. We purposefully have designed as much of our code as possible to be resilient against this sort of issue, but it’s not possible everywhere.

    The solution is to do a conflict test. This guide walks you through how to test for a conflict, and then identify what is conflicting.

    Please let us know what you find out. Cheers!

    – Brook

    #987659
    James
    Participant

    Hi Brook,

    I’ve been away for the last few days so I haven’t had a chance to look at the files. I’ve go through them again today and see if it is a conflict with a plugin and then I’ll get back to you.

    Cheers

    James

Viewing 15 posts - 1 through 15 (of 32 total)
  • The topic ‘Today's Date on Calendar is showing wrong day!’ is closed to new replies.