Magento2: Unable to save any dates if the user interface locale is not english (US) in 2.3.1

Created on 21 May 2019  路  40Comments  路  Source: magento/magento2

Preconditions (*)

  1. Magento 2.3.1
  2. A user with interface locale set to Greek

Steps to reproduce (*)

  1. Create a product using the user that has interface locale set to Greek.
  2. Add any date value, news_from_date, news_to_date, special_price_from_date, special_price_to_date
  3. Save the product

Expected result (*)

  1. The product is saved correctly with the new date.

Actual result (*)

  1. Error that says invalid date Invalid input datetime format of value '22/5/2019'

image

I've found other references in other issues that are closed saying this problem was fixed but unfortunately I'm on 2.3.1 and the issue persists. There's no real solution or workaround yet for this. Apparently it's not just Greek locale but other locales as well.

The bug has been acknowledged in the past, added to backlog even but years later we still face the same issue from version 2.1 to 2.3.1

Unless Magento is operating in a country where the users speak english natively it's pretty much pointless to use Magento if this is not fixed. I opened a new issue for this because any messages in closed issues get burried and never watched upon.

I'm hoping someone who understands the inner workings of this date format validation will pay attention to this or else the biggest question we'll have to ask any potential customer before choosing a platform will pretty much be: "Are you fluent in English?"

PS: at least if you could provide an official way to workaround this or what to change until it's fixed it would be completely fine so we can at least use the platform.

Catalog FrameworStdlib Fixed in 2.4.x Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.3.x Reproduced on 2.4.x good first issue

Most helpful comment

We have Fixed it and will commit soon

All 40 comments

Hi @ioweb-gr. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@ioweb-gr do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

@magento-engcom-team give me 2.3-develop instance

Hi @ioweb-gr. Thank you for your request. I'm working on Magento 2.3-develop instance for you

Hi @ioweb-gr, here is your Magento instance.
Admin access: https://i-22964-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

Reproduced on demo instance.

image

@ioweb-gr it's better to search for closed issues and reopen them to track regressions better.

https://github.com/magento/magento2/issues/9743 seems one of those, is it reproducible again? Is this issue introduced by 2.3.1 and not present in 2.3.0?

@orlangur For me it was never fixed in the first place. I can't seem to be able to track this issue that made me open a new one now, but it was a closed ticket with a few replies spaning over a year that the issue still persists.

I mean if noone reopened that ticket after a year or so, I kinda gave up on reopening closed issues.
Also I've tried to comment on a newer one #13112 which was for 2.2 version but it seems it was ignored as well for quite some time (from Jan 18).

It seems closed issues and old issues are never paid any attention to. You're right that it helps if it's reopened and worked on again, but it doesn't help if no one sees it.

It seems closed issues and old issues are never paid any attention to

@ioweb-gr well, it is simply impossible, unless anybody finds such issue and reopens it or if we have a proper end-to-end functional test covering this scenario.

Only collaborators can reopen issues they closed though so it's out of out hands but one choice would be to mark the duplicates when found and reopen the originals I guess in such cases.

I'm sure you agree that since we can't reopen them, and commenting on the closed is never read, our only option as users is to raise a new issue

Hi @Nazar65. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

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

    Details- Add the comment @magento-engcom-team 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_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x


@magento-engcom-team give me 2.3-develop instance

Hi @Nazar65. Thank you for your request. I'm working on Magento 2.3-develop instance for you

Hi @Nazar65, here is your Magento instance.
Admin access: https://i-22964-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

:white_check_mark: Confirmed by @engcom-backlog-nazar
Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-99821 were created

Issue Available: @engcom-backlog-nazar, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

https://github.com/magento/magento2/pull/18578/files related "PR" may be help to process on this issue.

Sorry, @stoleksiy, label Issue: Confirmed can be removed by Community Maintainers only

Hi @maheshWebkul721. 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. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.


Please assign me this issue

@chohanbhagchand, please note that it was assigned recently to @maheshWebkul721

Hello, there's any news about this issue? I'm facing the same problem when importing products

got a fix for now. in file vendor/magento/module-catalog/Controller/Adminhtml/Product/Initialization/Helper.php, function convertSpecialFromDateStringToObject().

Just comment out the line that says
$productData['special_from_date'] = $this->getDateTimeFilter()->filter($productData['special_from_date']);

and then it works.

------edit---------

Actually my fix only fixed the special from date. A better fix is in this file: vendor/magento/framework/Stdlib/DateTime/Timezone.php this function: appendTimeIfNeeded() change the line that says
$date .= " 0:00am";
to
$date .= " 00:00";

with the original line PHP was throwing an error:

DateTime::__construct(): Failed to parse time string (3/06/1977 0:00am) at position 14 (a): The timezone could not be found in the database

Which caused the try catch in vendor/magento/framework/Stdlib/DateTime/Filter/DateTime.php::filter() to fail. And causing this problem.

For me it didn't really work for either so I guess the above workaround is only specific for your case unfortunately :(

In Greek locale date format is dd/mm/yyyy. In English is mm/dd/yyyy.
Exactly here the new DateTime() is called.
Try new DateTime('25/06/2019'). Fatal error occurs, but with new DateTime('06/25/2019') works.

Sorry for bringing this up again, but I need to mention that this issue was raised about 2 months ago and I think it's going to get burried again like the original issues were 2+ years ago. It would be nice to know if there is at least a timeframe to fix this issue or an internal ticket number to track progress as it is a critical issue for non-English speaking users. Could someone let us know at least what the status is?

got same issue with korean locale here
i have tested in 2.3.2 instance

I'm hoping this issue will be given some attention again. Apparently this is a long standing thorn in Magento multilingual deployments.

Hi @Vitancourt. 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.


Hi @mahsn. 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:

  • [x] 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.


Reproduced in 2.3.3

Yep, i have the same problem in 2.3.3

We have Fixed it and will commit soon

Hi @cstergianos. 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.


@magento-engcom-team I created a pull request for this one here: https://github.com/magento/magento2/pull/25574. Let's hope that this is now fixed.

Hi @marcoaacoliveira. 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.4-develop branch

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


@ioweb-gr I'll work on it.

My first thought about it was changing my interface to Brazil/Portuguese (because we use dd/mm/yyyy format too, hoping that I would face the same problem) for my surprise I could save it in portuguese. When I change it for Greek it really mess something around and I'm not able to save date. So it looks like more a problem with the locale then the date format.

I'll get a more deeply analysis and I'll try to solve it.

@marcoaacoliveira Thanks for taking a look at it first of all. This is such a long standing issue. If you track the original issues you'll see it goes back all the way to 2016 and it occured on Australian locale as well. 4 years later it would be nice to have a real fix or at least a working workaround on this. I've tried to debug this but you have to dig very deep to understand the logic and the proper fix

@ioweb-gr I got to the root of the problem, I'll try to solve it today and open a PR.

@ioweb-gr I solved it. I'll do some test coverage and I'll open the PR.

@ioweb-gr now it's really solved, covered with tests. You can check it requesting a instance for test in the PR if you want:
https://github.com/magento/magento2/pull/26270

Hi @ioweb-gr. Thank you for your report.
The issue has been fixed in magento/magento2#26270 by @marcoaacoliveira in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.0 release.

Was this page helpful?
0 / 5 - 0 ratings