Skip to content

Fixed Datetime Error on Newsletter Template #15783

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

Closed

Conversation

patelnimesh1988
Copy link
Contributor

Fixed Datetime Error on Newsletter Template

Description

While save Queue Newsletter Queue Date Start Magento throw DateTime parse error. I have fixed that issue using Zend_Date class

Fixed Issues (if relevant)

  1. Datetime Error on Newsletter Template #5037: Datetime Error on Newsletter Template

Manual testing scenarios

  1. Login in Admin
  2. Click on Top right corner admin name then click on Account Setting.
  3. Change admin Interface Locale to Italiano (Svizzera) / italiano (Svizzera)
  4. Go to Admin->Marketing->Newsletter Template
  5. Select "Queue Newsletter" from right dropdown
  6. Select a "Queue Date Start" and try to save it

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@@ -335,10 +335,16 @@ public function formatDateTime(
*/
public function convertConfigTimeToUtc($date, $format = 'Y-m-d H:i:s')
{
$zendFormat = $this->getDateTimeFormat(\IntlDateFormatter::MEDIUM);
$zendDate = new \Zend_Date($date, $zendFormat, $this->_localeResolver->getLocale());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zend_Date must not be used, there were separate efforts to get rid of it.

Please rewrite implementation using only native PHP functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using PHP function but all function return same error while we add date like 29/giu/2016 01:22:19. I refer Magento 1 code and try to fix it. This error is throw by PHP function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patelnimesh1988 please go this way: #11306 (comment) Use something locale-aware from intl.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

@orlangur
Copy link
Contributor

Closing due to inactivity. Feel free to reach me out anytime later if you wish to continue work on this pull request and it will be reopened.

@orlangur orlangur closed this Jun 20, 2018
@patelnimesh1988
Copy link
Contributor Author

I am working on this issue

@orlangur orlangur reopened this Jul 4, 2018
@patelnimesh1988
Copy link
Contributor Author

@orlangur Please check my new changes.

@patelnimesh1988
Copy link
Contributor Author

patelnimesh1988 commented Jul 13, 2018

@orlangur Is this solution okay?

\IntlDateFormatter::FULL,
'GMT',
\IntlDateFormatter::GREGORIAN,
'dd-MM-yyyy H:i:s'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we skip some values here? Why timezone is GMT? Why $format is not used?

@sidolov
Copy link
Contributor

sidolov commented Sep 8, 2018

Hi @patelnimesh1988 , I am closing this PR now due to inactivity.
Please reopen and update if you wish to continue.
Thank you for the collaboration!

@sidolov sidolov closed this Sep 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants