Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start time and End Time not saving properly #114

Open
stsharp opened this issue Sep 17, 2018 · 3 comments
Open

Start time and End Time not saving properly #114

stsharp opened this issue Sep 17, 2018 · 3 comments

Comments

@stsharp
Copy link

stsharp commented Sep 17, 2018

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
Copy link

mattiiichen commented Mar 23, 2020

@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
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants