• Resolved iebsoftware

    (@iebsoftware)


    Hi,

    We have added an event for March 22nd 2021. It however displays the date on the front end screen as March 21st. We have as a result changed the date to be March 23rd in the back end and it displays March 22nd on the front end. We have tested adding times to the event and leaving blank, with the same result. It is always one day out. Is there an issue with the widget?

    Thanks,
    Dan.

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Spiffy Plugins

    (@spiffyplugins)

    It works fine on my system. What timezone do you have configured on your site?

    Thread Starter iebsoftware

    (@iebsoftware)

    We have the time zone set as London and the date format as 16/03/2021. Start date and End date for event are currently set as 2021-03-23, times are blank. The front end is showing 22/03/2021.

    I had a quick look and grabbed the stored timestamp from the database. The value stored is 1616454000 which translates to Monday, March 22nd 2021, 23:00:00 (GMT)

    See conversion here

    Plugin Author Spiffy Plugins

    (@spiffyplugins)

    The Spiffy Calendar dates are stored in the database in DATE format, which is YYYY-MM-DD. Where did you get the timestamp you were looking at?

    Thread Starter iebsoftware

    (@iebsoftware)

    Thanks, you are correct, I made an assumption and it turns out the dates are stored correctly in the DB.

    I have looked at the code, and it seems to be a line in this file:
    wp-content/plugins/spiffy-calendar/includes/views.php (line 1947)

    $this_timestamp = mktime($day_count*24,0,0,date("m",$current_timestamp),date("d",$current_timestamp),date("Y",$current_timestamp));

    The $this_timestamp variable is always coming out at 23:00 hours on the day before you would expect, as if it is adding only 23 hours and not 24. If I change the 24 to 25 it works as expected. I’m not a PHP expert and this has me stumped. Any ideas?

    • This reply was modified 3 years, 1 month ago by iebsoftware.
    • This reply was modified 3 years, 1 month ago by iebsoftware.
    Plugin Author Spiffy Plugins

    (@spiffyplugins)

    I would try disabling other plugins to see if the problem goes away. There might be some other plugin that is messing up the timezone.

    What values do you have for $day_count and $current_timestamp?

    Thread Starter iebsoftware

    (@iebsoftware)

    Everything looks fine with the current time. On the iteration of the loop for 23nd March:

    CurrentTimeStamp is 1615910560: Tuesday, March 16th 2021, 16:02:40 (GMT)
    Day_Count is 7
    Timestamp is 1616454000: Monday, March 22nd 2021, 23:00:00 (GMT)

    This means the displayed date on the event widget is 22nd March, not 23rd.

    I don’t think our Daylight Savings/ British summertime (BST) would affect it, that doesn’t kick in until March 28th.

    Plugin Author Spiffy Plugins

    (@spiffyplugins)

    I see the info you have added to the date class. When I compare to my system, the current_timestamp lines up closely, but the computed value for $this_timestamp is off. My values are:

    1: 1615939200
    2: 1616025600
    3: 1616112000
    4: 1616198400
    5: 1616284800
    6: 1616371200
    7: 1616457600

    Your timestamps all specify 11 pm on the night before. See here: https://www.epochconverter.com/

    Did you try running with other plugins disabled? Can you check your server settings?

    Thread Starter iebsoftware

    (@iebsoftware)

    Thanks for all the help. I’m still not sure why it is happening but it may be as you suggests a server setting or another plugin bug. An easy fix is to just add a further few hours onto the 24:

    $hours_to_add = $day_count*24 + 5;
    $this_timestamp = mktime($hours_to_add,0,0,date("m",$current_timestamp),date("d",$current_timestamp),date("Y",$current_timestamp));

    As the plugin isn’t showing times this is working fine for me.

    • This reply was modified 3 years, 1 month ago by iebsoftware.
    Plugin Author Spiffy Plugins

    (@spiffyplugins)

    Can you send me a list of your active plugins? If you don’t want to post it here you can use the contact form at https://spiffycalendar.spiffyplugins.ca/contact/

    fh2021

    (@fh2021)

    Hi
    i spent 1 week uploading events and when i was testing everything worked fine when viewing the page while logged in.

    now i send the page to our subscribers and they are sharing the same issue that the calendar dates are appearing 1 day earlier.

    i have a sydney timezone set

    i also tested by disabling all plugins and it doesnt fix the issue

    please confirm asap what i have to do as i have invested too much time in creating events in this plugin

    thanks

    Plugin Author Spiffy Plugins

    (@spiffyplugins)

    Can you provide a link and details of what you expect to see?

    fh2021

    (@fh2021)

    The issue is very simple

    we add dates in the events lets say an event date is set to start on the 13th of April 2021 with a start time of 9am and end time of 5pm

    When we show the calendar “upcoming events” the event for the 13th is appearing as the 12th.

    if we show the calendar as a month calendar view i noticed that it is appearing correctly as the 13th.

    From my testing the issue is only occurring when the calendar is displayed as upcoming events.

    Plugin Author Spiffy Plugins

    (@spiffyplugins)

    This issue is not happening on my test sites. There is something unique in your server setup that is disrupting the time display. I suspect it is related to the switch from Daylight Savings Time that is coming up for Sydney. I sent you an email asking for a link and login to investigate.

    Plugin Author Spiffy Plugins

    (@spiffyplugins)

    The issue turned out to be the theme setting date_default_timezone_set(). It is set to UTC in wp-settings.php and should not be changed. This results in timezone offset being applied twice and throwing off the date calculation.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Wrong Day displayed on spiffy-upcoming-list widget’ is closed to new replies.