Magestore / Bannerslider-Magento2

Banner Slider Extension on Magento 2 - best way to capture the eyes of visitors!
http://www.magestore.com/banner-slider-on-magento2.html/
82 stars 100 forks source link

Start time and End Time not saving properly #114

Open stsharp opened 5 years ago

stsharp commented 5 years ago

It seems if we try to adjust the start and end time to an exact minute, it is not saved that way. It seems that the following code will help fix this:

File: Controller/Adminhtml/Banner/Save.php Line 107 Change from $data['start_time'] = $localeDate->date($data['start_time'])->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d H:i'); TO $data['start_time'] = $localeDate->date(new \DateTime($data['start_time']))->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d H:i');

Line 108 Change from $data['end_time'] = $localeDate->date($data['end_time'])->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d H:i'); To $data['end_time'] = $localeDate->date(new \DateTime($data['end_time']))->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d H:i');

mattiiichen commented 4 years ago

@stsharp I tried to fix start time and end time as your code provided. But It doesn't work for me. Any ideas? or I did miss something ?

mattiiichen commented 4 years ago

For example: Now America/Chicago time is 3/23 1:15 AM I tried to edit start time of banner. After save that, the time become to 3/22 8:15 PM. The banner grid of admin panel is not display correctly. But the banner applying time is correct. If the time pass to 3/23 1:15 AM, the banner will be display to frontend. Any one know how to fix this issue?

screenshot 2020-03-23 PM 2 15 16 screenshot 2020-03-23 PM 2 15 30

screenshot 2020-03-23 PM 2 16 50
mattiiichen commented 4 years ago

I found if install this module to Magento 2.2, there is no issue about save start_time and end_time problem. But install into Magento 2.3, will be caused this issue happen.