Skip to content

Set product as new "from" and "to" not being interpreted correctly #10580

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
gwharton opened this issue Aug 18, 2017 · 37 comments
Closed

Set product as new "from" and "to" not being interpreted correctly #10580

gwharton opened this issue Aug 18, 2017 · 37 comments
Assignees
Labels
bug report Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@gwharton
Copy link
Contributor

Preconditions

  1. Magento 2.1.8 CE
  2. Locale set to GB

Steps to reproduce

  1. Create product
  2. Set product new from and new to dates to be 1st Aug 2017 to 1st Sep 2017

Expected result

  1. Product is listed as new in "New products Widget" if viewed during August 2017

Actual result

  1. Product is not listed as new in "New products Widget"
  2. Set product new from and new to dates to be 8th Jan 2017 to 9th Jan 2017
  3. Product is listed as new in "New products Widget" if viewed during August 2017

Looks like month and day have been interchanged.

You can also get an error when you try to set a date like 31st Aug 2017, which it says is invalid. Presumably trying to set the 8th day of the 31st month.

May be GB specific due to having date specification dd/mm/yy instead of the US mm/dd/yy

@orlangur
Copy link
Contributor

GB locale is not builtin https://github.com/magento/magento2/tree/develop/app/i18n/Magento, is there a publicly available link to the one you used?

@gwharton
Copy link
Contributor Author

Hi,

php bin/magento setup:static-content:deploy en_GB en_US

Under the admin pages, click arrow next to username in top right->Account Setting-Interface Locale->English (United States)

Product->Misc->Set Product New From ->Use Calendar and set 31st August 2017.
Product->Misc->Set Product New To->Use Calendar and set 30th September 2017.

Save Product OK, No error.

Under the admin pages, click arrow next to username in top right->Account Setting-Interface Locale->English (United Kingdom)

Product->Misc->Set Product New From ->Use Calendar and set 31st August 2017.
Product->Misc->Set Product New To->Use Calendar and set 30th September 2017.

Save Product -> ERROR Invalid input datetime format of value '31/08/2017'

@orlangur
Copy link
Contributor

@gwharton thanks, I was not aware en_GB was always there, just without separate translation files.

@oleg-onufer
Copy link
Contributor

oleg-onufer commented Aug 25, 2017

Hi @gwharton.
Thanks for reporting this issue.
Internal ticket MAGETWO-71938 was created.

@sinamiandashti
Copy link

also happens on fa_IR
plz fix this

@gediminaskv
Copy link

gediminaskv commented Aug 30, 2017

I have date problems also on lt_LT. Actually I can not save correct date. The date field shows 201717-08-30 instead of 2017-08-30 after page reloads. And when I look to the database I see 1717-08-30.

Change locale to en_US fix this issue as suggested by #10485 (comment)

@dpaleino
Copy link

Duplicate of #10472 ?

@glaucomorais
Copy link

This is happening with pt_BR language too.
The calendar and/or the field is not respecting locale settings?

@magento-engcom-team magento-engcom-team added bug report G1 Passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed and removed G1 Passed labels Sep 5, 2017
@ajmedway
Copy link

More insane and very serious bugs. So far Magento 2 has been such a rocky road. Endlessly need to keep patching/investigating problems in the core code.

@cdnilanga
Copy link

cdnilanga commented Sep 22, 2017

I'm having the same issue. I just updated "module-ui/Component/Form/Element/DataType/Date.php" prepare() method to set timeOffset only which seems to have fixed it. However need to do a full test to make sure it has not affected other modules that might be relying on storeTimeZone, dateFormat & storeLocale.

Update: so far didn't find an issue with the update, so if anyone interested here is the code change.
replace line 64-71 with below
if (!isset($config['timeOffset'])) { $config['timeOffset'] = (new \DateTime( 'now', new \DateTimeZone( $this->localeDate->getConfigTimezone() ) ))->getOffset(); }

@magento-engcom-team
Copy link
Contributor

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

@Yosuatel
Copy link

It also happens for es_ES this I am using magento 2.1.9, setup on clean, PHP version 7.0.23

@devhero-tech
Copy link

thanks @Tomasz-Silpion , I made upgrade to 2.2 and works fine :)

@gwharton
Copy link
Contributor Author

Just so we are clear @devhero-tech and @Tomasz-Silpion, this github issue is regarding the month and date being the wrong way round for several locales. i.e when you request 30/10/2017 in the UK (and i suspect any locale where the day comes before the month), it says it is invalid, because it thinks you are trying to set the date to the 10th day of the 30th month.

The issue that the above patch is fixing is where the datetime string is being interpreted as 01/01/+00201717 etc. which is a separate issue and covered under #10485

@pablobae
Copy link

If you have the locale set to es_ES, product import fails to due this date format issue

@luckyduck
Copy link

Same for de_DE on 2.1.9

@sergiomendonca
Copy link

I have installed magento 2.2.0. It continues not working after 2 years.

@orlangur
Copy link
Contributor

orlangur commented Feb 2, 2018

issue reported on Aug 18, 2017
It continues not working after 2 years.

:)

@pablobae
Copy link

pablobae commented Feb 2, 2018

@orlangur ... 2 years or 6 months, Problems with dates and internationalization make Magento 2 almost unfeasible :(

@bvboas
Copy link

bvboas commented Feb 2, 2018

we will probably see this fixed on 2.3 and not being backported to 2.1 and 2.2...

@luckyduck
Copy link

luckyduck commented Feb 2, 2018

This is in fact a major problem when you work with clients. Enough papercut-like problems like these undermine the credibility of the whole platform.

However, there is a fix available, which works at least for 2.1.x:
https://github.com/mmularski/magento2-locale-date-time

adapted for de_DE:
https://github.com/luckyduck/magento2-locale-date-time

@sergiomendonca
Copy link

@luckyduck , this module have many fails. It does not correct all the bugs of all modules that magento 2.x appears. Example: Marketing Module and Reports continue not working with this module.

@luckyduck
Copy link

luckyduck commented Feb 2, 2018

@sergiomendonca Agreed. Just wanted to point out that there is a solution to some of the problems. At least in my case (advanced pricing / from/to), that helped me a lot.

@sergiomendonca
Copy link

Thanks by the feedback. I think its the one solution until here.

@raumatbel
Copy link
Contributor

I think I have the solution for this problem.
I am working in this PR and it is "in Review". Could you check it if you want?

@magento-engcom-team
Copy link
Contributor

Hi @gwharton. Thank you for your report.
The issue has been fixed in #11306 by @raumatbel in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Feb 8, 2018
@sergiomendonca
Copy link

About all filters date? Order filter by date, invoice filter by date, customer filter by date, page filter by date. All of them is in en_us format and its not possible to make something different without change the core code of magento 2. Someone know about this issue? I downloaded the v2.2 and all the filters that i told is not fixed.

@gwharton
Copy link
Contributor Author

Seems to be fixed in 2.2 now

@rubenromao
Copy link

rubenromao commented Dec 20, 2019

Hi @gwharton. Thank you for your report.
The issue has been fixed in #11306 by @raumatbel in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

that's not true.
I'm on 2.3.2 and the bug is still present.

@LusienGG
Copy link

still not working for bg_BG in 2.3.1

@TOIVI291
Copy link

Still not working for nl_NL in 2.3.4

@Adam-afk-cmd
Copy link

Can confirm still not working for ar_SA in 2.3.5-p1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests