VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: billo007 on December 08, 2017, 18:36:42 PM

Title: Wrong date and times on orders
Post by: billo007 on December 08, 2017, 18:36:42 PM
Virtuemart 3.2.8 joomla 3.8.2 all of a sudden time is wrong on orders about 3 hours off. Checked time zone in joomla and server and they are both correct any ideas what could of caused it?
Title: Re: Wrong date and times on orders
Post by: Jörgen on December 10, 2017, 14:17:38 PM
Hello If i remember correctly virtuemart does not store servertime it stores universal timezone. This is not adjusted for printout.
Regards
Jörgen @ Kreativ Fotografi
Title: Re: Wrong date and times on orders
Post by: jenkinhill on December 10, 2017, 14:24:38 PM
Quote from: Jörgen on December 10, 2017, 14:17:38 PM
Hello If i remember correctly virtuemart does not store servertime it stores universal timezone.

And was eloquently described in https://forum.virtuemart.net/index.php?topic=134222.0
Title: Re: Wrong date and times on orders
Post by: Mike J on December 11, 2017, 00:48:58 AM
Hi billo007,

After updating to Virtuemart 3.2.8 / Joomla 3.8.2 my order times are now also out (1 of these 2 updates responsible).

As Virtuemart does not store servertime I take it that Joomla is the culprit... Did you find a solution?

If so could you share?
Title: Re: Wrong date and times on orders
Post by: Milbo on December 11, 2017, 14:46:31 PM
Virtuemart should always store in GMT. But there is a bug in vmjsapi.php around line 878 function "date".

just add a "false" as new parameter to the JHtml functions. For example
Quote
$formatedDate = JHtml::_('date', $date, vmText::_('DATE_FORMAT_'.$format));
to
Quote
$formatedDate = JHtml::_('date', $date, vmText::_('DATE_FORMAT_'.$format),false);
Title: Re: Wrong date and times on orders
Post by: Mike J on December 11, 2017, 22:32:07 PM
Many thanks Milbo,

That sorted mine out. Muchly appreciated.

For others:

administrator/components/com_virtuemart/helpers/vmjsapi.php

Line 884 (changed 'null' to 'true') as per:

Quote$formatedDate = JHtml::_('date', $date, vmText::_('DATE_FORMAT_'.$format),null);

to:

Quote$formatedDate = JHtml::_('date', $date, vmText::_('DATE_FORMAT_'.$format),true);
Title: Re: Wrong date and times on orders
Post by: billo007 on December 12, 2017, 08:14:52 AM
Worked like a charm

Many Thanks
Title: Re: Wrong date and times on orders
Post by: Milbo on December 12, 2017, 13:20:47 PM
I am sorry, it is false (I corrected my post). True takes the timezone of the user. false takes the time of timezone of the shop. But okey, most time, it makes no difference if you use true or false
Title: Re: Wrong date and times on orders
Post by: Mike J on December 13, 2017, 15:10:06 PM
Ok, nice to know. Many thanks... Awesome work as always!