Author Topic: Wrong date and times on orders  (Read 715 times)

billo007

  • Jr. Member
  • **
  • Posts: 51
Wrong date and times on orders
« 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?

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1608
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Wrong date and times on orders
« Reply #1 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
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26924
  • Always on vacation
    • Jenkin Hill Internet
Re: Wrong date and times on orders
« Reply #2 on: December 10, 2017, 14:24: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
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM.3.2.15.9866 on Joomla 3.8.10 PHP 7.0.30

Testing VM.3.2.15.9898 on J3.8.10

Mike J

  • Beginner
  • *
  • Posts: 25
Re: Wrong date and times on orders
« Reply #3 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?
Virtuemart 3.2.8
Joomla 3.8.2
PHP 7.0

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9607
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Wrong date and times on orders
« Reply #4 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);
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Mike J

  • Beginner
  • *
  • Posts: 25
Re: Wrong date and times on orders
« Reply #5 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);
Virtuemart 3.2.8
Joomla 3.8.2
PHP 7.0

billo007

  • Jr. Member
  • **
  • Posts: 51
Re: Wrong date and times on orders
« Reply #6 on: December 12, 2017, 08:14:52 am »
Worked like a charm

Many Thanks

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9607
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Wrong date and times on orders
« Reply #7 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
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Mike J

  • Beginner
  • *
  • Posts: 25
Re: Wrong date and times on orders
« Reply #8 on: December 13, 2017, 15:10:06 pm »
Ok, nice to know. Many thanks... Awesome work as always!
Virtuemart 3.2.8
Joomla 3.8.2
PHP 7.0