Coupon expiration decreases by one hour on save

  • Posts: 37
  • Thank you received: 1
9 years 4 weeks ago #196372

-- HikaShop version -- : 2.4.0

I was trying to set a coupon to expire on a future date at 23:59 (the coupon is restricted to the UK zone in case this is relevant) but every time I save the coupon the expiration time decreases by one hour. SAVE 22:59, SAVE 21:59, etc. To achieve what I wanted I had to set the expiration time to 24:59 and press SAVE, which is clearly a little bizarre.

This would appear to be a bug. What are these expiration times relative to? Server time?

Regards,

Martin

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

  • Posts: 13201
  • Thank you received: 2322
9 years 4 weeks ago #196375

Hi,

I think indeed that the server hour is different than the one used in Joomla, and that could cause this behavior.
I was not able to reproduce the issue on my end.

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

  • Posts: 88
  • Thank you received: 19
6 years 6 months ago #280166

Have the exact same issue - tried different time zone settings in joomla config, but it didn't make a difference to the behavior.

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

  • Posts: 88
  • Thank you received: 19
6 years 6 months ago #280187

Actually I just found out how to "trigger" this issue, and what is causing the issue... It's related to daylight saving time.

Currently we are on "summer time" and if I select a starting date within summer time, everything is ok.
But if I select a starting date after oct. 29 (winter time), then one hour is added to the time every time I save the coupon.

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
6 years 6 months ago #280199

Hi,

Thank you for your feedback.
Thanks to that, and after numerous tests, I think we found the cause and the solution.
It happens only when the current date is in a different summer/winter time range than the date you're entering. So if you're in summer time and you enter a date in summer date, or if you're in winter time and enter a date in winter time, it works fine.
Change the line:
return $date - $timeoffset *60*60 + date('Z');
to:
return $date - $timeoffset *60*60 + date('Z', $date);
in the file administrator/components/com_hikashop/helpers/helper.php and that should fix the issue like it did on our end. We'll add that patch for the next version of HikaShop.

The following user(s) said Thank You: dyvel

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

  • Posts: 88
  • Thank you received: 19
6 years 6 months ago #280243

This fixed the issue at our end as well - thanks :-)

The following user(s) said Thank You: Philip

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

Time to create page: 0.086 seconds
Powered by Kunena Forum