Skip to main content

hikashop_getTime() uses today's UTC offset, so datepicker fields show the previo

3 weeks 3 days ago - 3 weeks 3 days ago #100000417 by Genr8r
hikashop_getTime() uses today's UTC offset, so datepicker fields show the previous day across a DST change

HikaShop 6.7.1 (same code in 6.6.0), Joomla site timezone America/Los_Angeles, server PHP timezone UTC.

A datepicker custom field stores 20261125000000. In the backend order view and edit form it displays as 11/24/2026. Dates before the DST change display correctly.

Cause: datepickerfield getTimestamp() passes "2026/11/25" to hikashop_getTime(). That falls back to strtotime() and then applies
Code:
$date - $timeoffset*60*60 + date('Z', $date)
, where $timeoffset is computed once from Factory::getDate('now', $timeZone). Today that is UTC-7 (PDT), but 11/25 is in PST, which is UTC-8, so the result is 11/24 23:00 local.

The plugin's "Set hour to noon" option hides the display problem but moves the forbidden-weekday check in check() by a day (a Saturday is rejected as Sunday), so it is not a workaround for us.

Suggested fix: compute the offset for the date being converted, e.g. new DateTime($date, new DateTimeZone($timeZone)) then getTimestamp(), instead of the cached "now" offset.
Last edit: 3 weeks 3 days ago by Genr8r.

Please Log in or Create an account to join the conversation.

3 weeks 3 days ago #100000420 by nicolas
Hi,

Thank you for the detailed analysis, it was right. hikashop_getTime() corrected dates with today's offset of the site timezone instead of the offset of the date itself, so on a site in America/Los_Angeles a date after the switch back to standard time (such as 11/25/2026, stored as 20261125000000) was shown one day early in the order view and edit form. Separately, with the "Set hour to noon" option of the date picker plugin, the server-side check computed the weekday from a shifted timestamp, which is why a Saturday could be refused as a Sunday.

Both are fixed in the latest build of HikaShop 6.7.1: the date is now read with the offset of that date (as you suggested), and the forbidden weekday check uses the calendar date itself, with or without "Set hour to noon". Download it from your account on our website and install it over your current HikaShop. It has the same version number, so Joomla's updater will not offer it, and your settings are kept.

Nothing changes in the stored values: 20261125000000 is then displayed as 11/25/2026 again. You can also turn "Set hour to noon" off again if you only enabled it to work around the display problem.

Please Log in or Create an account to join the conversation.

3 weeks 3 days ago #100000422 by Genr8r
Hi Nicolas,

Thank you for the quick turnaround and for fixing both issues, including the weekday check with "Set hour to noon". We'll install the updated 6.7.1 build over our current one and confirm here if anything looks off.

Much appreciated!
The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.052 seconds
Powered by Kunena Forum