News:

Looking for documentation? Take a look on our wiki

Main Menu

Date field one day behind offset problem

Started by jawadakr, August 11, 2017, 17:31:21 PM

Previous topic - Next topic

jawadakr

Hi there

I am using vm 3.2.2 with joomla 3.7.4 on a website with standard linux installation and php 5.5.9-1ubuntu4.22

now the strange problem i am facing is that whenever we enter a date in the date calendar (vm custom field). the joomla is saving it one day behind.

any body else experience something like this before ?

Regards

Jawad

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

jawadakr

Hi Milbo

thanks for the quick reply but I am still facing the same problem with shopper fields on both FE and BE after installing the updated version.

Do I have to set some config options as well ?

Regards

Jawad


jawadakr

I was able to fix the problem on my own.

It seems that the function broke when we use some other format instead of default one.

I was able to solve this problem by adding this code in vmjsapi.php file in administrator/component/com_virtuemart/helpers directory.

The code below starts at line # 816 for me

if ($date) {
         $formatedDate = JHtml::_('date', $date, $dateFormat );
            // date patch for the one day behind issue.
$date1 = new DateTime($date);
         $formatedDate = $date1->format("$dateFormat");
           
      }
      else {
         $formatedDate = vmText::_('COM_VIRTUEMART_NEVER');
      }

Milbo

Quote from: jawadakr on August 28, 2017, 20:58:08 PM
The code below starts at line # 816 for me


if ($date) {
$formatedDate = JHtml::_('date', $date, $dateFormat );
            // date patch for the one day behind issue.
$date1 = new DateTime($date);
$formatedDate = $date1->format("$dateFormat");


For what do you need $formatedDate = JHtml::_('date', $date, $dateFormat ); ? I think you can remove this line[/code]
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

jawadakr

Oh that is the default code :) I just commented it.