Newsletter date translation
Preconditions
Magento 2 is installed French pack of translation is installed
Steps to reproduce
- Go to Newsletter templates and start a new queue
Expected result
When you choose a date with the jquery picker, date is formated on the right DB format
Actual result
It is formated with the french format and there is an error with wrong date format on server side
Hello @arthursp ! Looks like this issue belongs to pack which you have installed. I cannot reproduce this case on magento french locale
@arthursp could you please provide additional information
Hi, On back office, when you translate date ( on french in my case) , when its submited, an error appear concerning date format. Get Outlook for iOS
On Wed, Jun 22, 2016 at 6:05 PM +0200, "Mykola Palamar" [email protected] wrote:
@arthursp could you please provide additional information
You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/magento/magento2/issues/4642#issuecomment-227792589
@arthursp could you please specify Magento version used? Please also provide more detailed steps you did for "Install a french pack of translation" step. And do you claim that the bug is in the date format which admin sees when he selects date picker, or the way how it saved in the DB?
It was 2.0.4
the pack is imaginaerum : http://imaginaerum.github.io/magento2-language-fr-fr/
I put it on app/i18n/imaginaerum/fr_fr/dictionary.csv
The error is : a:4:{i:0;s:117:"DateTime::__construct(): Failed to parse time string (31 août 2016 13:59:12) at position 0 (3): Unexpected character";i:1;s:5345:"#0 vendor/magento/module-newsletter/Model/Queue.php(185): DateTime->__construct('31 ao\xC3\xBBt 2016 1...')
caused by the fact that the form is sent with french date format.
Maybe it's a timezeone problem , when override /vendor/magento/module-newsletter/Model/Queue.php like this :
/**
* Set $_data['queue_start'] based on string from backend, which based on locale.
*
* @param string|null $startAt start date of the mailing queue
* @return $this
*/
public function setQueueStartAtByString($startAt)
{
if ($startAt === null || $startAt == '') {
$this->setQueueStartAt(null);
} else {
try{
$search = array('janv.', 'févr.', 'mars', 'avr.', 'mai','juin', 'juil.', 'août', 'sept', 'oct.', 'nov.', 'déc.');
$replace = array('Jan', 'Feb', 'Mar', 'Apr', 'May','Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
$startAt = str_replace($search, $replace, $startAt);
$time = (new \DateTime($startAt))->getTimestamp();
}catch(\Exception $e){
echo '<pre>';print_r($e->getMessage());exit();
}
$this->setQueueStartAt($this->_date->gmtDate(null, $time));
}
return $this;
}
It's working, maybe you should use DateTime::createFromFormat http://php.net/manual/fr/datetime.createfromformat.php
I meet the same issue. Steps to reproduce:
- Set Account Setting > Interface Locale > Chinese(China)
- Stores > configuration > General > Locale Options > Local > China
- Marketing > Newsletter Template choose a template do the action "Queue Newsletter"
- The first field "Queue Date Start" is a jquery picker in Chinese string, like "2016年10月7日 a2:09:20"
- When I click the "Save Newsletter", the error happens
1 exception(s):
Exception #0 (Exception): DateTime::__construct(): Failed to parse time string (2016年10月7日 a2:09:20) at position 4 (�): Unexpected character
If the Interface Locale and Local are all set to be USA, there will be no problem.
Internal Ticket was created MAGETWO-59954
There is a proposed fix for this issue, #10736. Any feedback on this would be much appreciated!
@arthursp, thank you for your report. We've created internal ticket(s) MAGETWO-59954 to track progress on the issue.
Hi @webkul-ratnesh. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
-
[ ] 1. Add/Edit
Component: XXXXXlabel(s) to the ticket, indicating the components it may be related to. -
[ ] 2. Verify that the issue is reproducible on
2.3-developbranchDetails
- Add the comment@magento give me 2.3-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.3-developbranch, please, add the labelReproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! -
[ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.
- Join Magento Community Engineering Slack and ask your questions in #github channel.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!