Jefferson49/Joomla_plugin_sexypolling_reloaded

Start/end dates polls issue

Closed this issue · 8 comments

Hi Jefferson
First of all thanks for resurrecting sexypolling. I having an issue with the start/end dates of the polls. Every time I save the settings the scheduled dates go back one day on the calendar. Any ideas?
Please take a look at my video in which I show the issue: https://youtu.be/on829xKmfgU

This happens both in live site (j3.10.12) and in a local server (j.4)

Hi gnutello, thank you very much for reporting the issue and the perfect video to explain the behavior; that really helps!

At the first try, I could not reproduce the issue in my installations. I will continue to check.

Recently, I changed some code about time zones. I guess this could be an explanation for the behavior. The date in the front end should be shown in your user time zone and the date in the database should be stored in the standard UTC time zone. If you work in a time zone, which has a large time difference to UTC, the dates might be different between your time zone and UTC and this might explain the behavior.

Can you provide me some more information for both of your installations (Joomla 3.10 and 4.x):

  • Time zone (of the logged in administrator)
  • Sexy polling version; I guess v5.0.1?
  • Did the issue also occur with earlier versions? Latest version, where it did not occur?
  • PHP version

Hi Jefferson
the issue is old and affect also the old versions of Sexypolling.
So, If you not reproduce the issue on your installations, then I assume that the cause must be iside my installations for some mysterious reasons.

The user time zone of my installations is +1 Italy (I don't know how verify the database UTC)

J 3.10.12
Sexy polling 5.0.1
PHP version 8.2.9

J 4.4
Sexy polling 5.1
PHP version 8.2.0

Thanx for the additional information.

With some further testing, I was manage to reproduce the issue if setting the server time zone to a time zone with a different date (e.g. Sidney in Australia, which is far away from UTC in London).

The server time zone can be changed in the following menu:
System > Setup > Global configuration > Server > Location > Website Time Zone

server_time_zone

Can you check and post your server time zone settings? Does the server time zone have a huge time difference to UTC (London)?

Hi, my server time zone setting was Rome and the difference to UTC London is just +1. Following your suggest I tried changing the settings using London time (non only in the global configuration but also in all the super administrator users) but nothing change. My issue is always there.

Seems that the issue is just mine, I think nobody reported something similar.
Anyway to start the poll I will set the dates one day later my needs so that when I save the poll the scheduled date will be the right one. In the past polls that I ran I have done so

It is also possible to set the PHP timezone in the php.ini file. Maybe, your server is using the values of the php.ini file with a higher priority than the settings in the Joomla backend.

In the php.ini file, you should find the following lines, where the timezone can be set (in this example: "UTC"):

[Date]
; Defines the default timezone used by the date functions
; https://php.net/date.timezone
date.timezone ="UTC"

You can check the currently activated settings of PHP by opening a phpinfo.php file on your server. In the date sections, you should find something like this:

PHP_timezone

Today, I was able to find the root cause in the code and was able to fix it (14cd66b). In my own installations, the start and end dates do not change any more even if other server timezones are chosen.

I will release the bugfix in a new version.

Many thanks!!!!

I confirm that it works perfect now with the last upgrade.
Many thanks!