Author Topic: Problem with dates for multiple prices  (Read 722 times)


  • Jr. Member
  • **
  • Posts: 314
Problem with dates for multiple prices
« on: June 12, 2019, 16:46:02 pm »
I already asked about this 4 years back back here I am again :)

I run a site which uses CEST timezone, so we have UTC +2
When I try to set a time-limited price and select today as publish_up and tomorrow as publish_down date for it, VM stores 2019-06-12 00:00:00 and 2019-06-13 00:00:00 in #__virtuemart_product_prices table.
But when you check loadProductPrices method in VirtueMartModelProduct, there is `product_price_publish_down` >= "' .$db->escape($this->_now) . '" where $this->_now is  JFactory::getDate()->toSQL() which is UTC
So this price will be deactivated at 2AM tomorrow because at local midnight will be 10PM in UTC

What do you suggest, which is the correct way to use the real timezone but have the correct price publish up/down times?


  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10094
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Problem with dates for multiple prices
« Reply #1 on: June 20, 2019, 16:23:20 pm »
thank you for the bug report.

in the product model, function loadProductPrices use this

Code: [Select]

$config = JFactory::getConfig();
$siteOffset = $config->get('offset');
$siteTimezone = new DateTimeZone($siteOffset);

$jnow = JFactory::getDate();
$date = new JDate($jnow);
$this->_now = $date->format('Y-m-d H:i:s',true);

//vmdebug('my timezone ',$this->_now);

for the if(!isset($this->_now)){
I should fix your bug, please support the VirtueMart project and become a member
Extensions approved by the core team: