magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Newsletter date translation

Open arthursp opened this issue 10 years ago • 13 comments

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

arthursp avatar May 23 '16 13:05 arthursp

Hello @arthursp ! Looks like this issue belongs to pack which you have installed. I cannot reproduce this case on magento french locale

oserediuk avatar Jun 08 '16 11:06 oserediuk

@arthursp could you please provide additional information

palamar avatar Jun 22 '16 16:06 palamar

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 avatar Jun 22 '16 16:06 arthursp

@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?

veloraven avatar Aug 30 '16 12:08 veloraven

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

arthursp avatar Aug 30 '16 12:08 arthursp

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.

arthursp avatar Aug 31 '16 12:08 arthursp

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

arthursp avatar Aug 31 '16 12:08 arthursp

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.

PiscesThankIT avatar Oct 07 '16 14:10 PiscesThankIT

Internal Ticket was created MAGETWO-59954

veloraven avatar Oct 21 '16 15:10 veloraven

There is a proposed fix for this issue, #10736. Any feedback on this would be much appreciated!

miguelbalparda avatar Sep 01 '17 13:09 miguelbalparda

@arthursp, thank you for your report. We've created internal ticket(s) MAGETWO-59954 to track progress on the issue.

magento-engcom-team avatar Oct 18 '17 13:10 magento-engcom-team

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: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced 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.


m2-assistant[bot] avatar Oct 23 '19 08:10 m2-assistant[bot]

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!

stale[bot] avatar Feb 14 '21 22:02 stale[bot]