Date changes on save

When I save a slider, the start and end date changes to 2 hours later on save.
The selected time zone in Magento -- Configuration -general -- local option is Europe/Amsterdam.
We use Magento 2.3.2, Ubertheme Content Slider 1.1.3
Can you fix this problem?

4 answers

Profile photo of Mall Staff 184060.00 $tone August 7, 2019
Public

Hi there,
I’ve checked and see our sliders are stored correctly in accordance with standard Magento 2 timezone (UTC). You can cross check this info directly in your database at the table ‘ubcontentslider_slide_item.start_time’.
Under your circumstance, it shows the difference when that UTC timezone was converted to your locale Europe/Amsterdam.
Please consider one of the options below:
-- You set your global system timezone to UTC. Or,
-- You calculate the expected time that you want to publish the slider. Then you enter this time minus the different 2 hours.
For example, the slider will be published on 8am (Europe/Amsterdam). Then you enter the slider to be published at 6am (Europe/Amsterdam).
Regards,
Mall.

#1
Profile photo of ubdev Staff 98150.00 $tone August 7, 2019
Public

Hi there, 
Please discard our suggestion in reply #1 above, we checked further and saw the time difference upon saving the slider. We’re working on it and will let you know the workaround soon. 
Thanks,
Ubertheme team

#2
Profile photo of Mall Staff 184060.00 $tone August 7, 2019
Public

Hi there,

When I save a slider, the start and end date changes to 2 hours later on save. 

Please follow steps below to solve the issue you mentioned:
+ Download the PHP file here
and then upload to overwrite the file at: app/code/Ubertheme/UbContentSlider/Controller/Adminhtml/Item/PostDataProcessor.php
+ Download the PHP file here
and then upload to overwrite the file at: app/code/Ubertheme/UbContentSlider/Block/Adminhtml/Item/Edit/Tab/Main.php
+ Once done, run the CLI command: php -f bin/magento setup:di:compile
 
Then, check the issue and let me know how it goes.
 
Regards,
Mall.

#3
Profile photo of Mall Staff 184060.00 $tone August 7, 2019
Public

Hi there,
Please follow additional steps below as well to ensure that the front-end works fine when your slider is filtered by UTC start time and end_time:
+ Open the PHP file at: app/code/Ubertheme/UbContentSlider/Model/ResourceModel/Slide.php
and find the code line:

$dateTimeNow = $this->_stdTimezone->date()->format('Y-m-d H:i:s');

and replace it with:

$dateTimeNow = new \DateTime('now', new \DateTimeZone('UTC'));
$dateTimeNow = $dateTimeNow->format('Y-m-d H:i:s');

+ And then, clean M2 cache. 

Regards,
Mall.

#4

Please login or Register to Submit Answer

Written By

Comments