Skip to content
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

Reports and date format #7037

Closed
pitangaweb opened this issue Oct 16, 2016 · 30 comments
Closed

Reports and date format #7037

pitangaweb opened this issue Oct 16, 2016 · 30 comments
Labels
bug report Component: Translation Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@pitangaweb
Copy link

Preconditions

  1. Magento 2.1.1
  2. PHP 7.0.12

Steps to reproduce

  1. Create an administrator user, set their language to French (France), and login to the backend using their credentials.
  2. Open "Reports" > "Coupon" (or any report) and enter the following dates: October 1st 2016 to October 16th 2016.
  3. Try to "display" the report.

Expected result

  1. It should display the report

Actual result

  1. It crashed with the following error:Invalid input date format '16/10/2016'";i:1;s:6482:"#0 /PATH-T)-MAGENTO2/vendor/magento/zendframework1/library/Zend/Filter.php(114): Magento\Framework\Stdlib\DateTime\Filter\Date->filter('16/10/2016')

Looks like an error on the date format where day and month are inverted.

@miakusha
Copy link
Contributor

Hi @pitangaweb , thanks for report
We've created internal ticket MAGETWO-59810 to address this issue.

@miakusha miakusha added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Oct 18, 2016
@janeblonde
Copy link

janeblonde commented Nov 22, 2016

I've the same issue, attached is the error
non us date error
There is no issue if I use a date like 11/11/2015 to 11/11/2016

@janeblonde
Copy link

Is there an update on this, did anyone find a resolution?

@sma09sjb
Copy link

sma09sjb commented Dec 2, 2016

Why has this been closed? I'm experiencing this issue in Magento 2.1.2, can this be fixed as soon as possible please.

@janeblonde
Copy link

I'd hoped this would be fixed in 2.1.3. Is there an ETA on when this can be fixed or possibly a hot fix?

@pitangaweb
Copy link
Author

Any update on this ? The whole Reports section is broken.

@janeblonde
Copy link

At this stage, I'm crying out for a solution!

@janeblonde
Copy link

it's the bug that keeps on giving:
#6323

@janeblonde
Copy link

this wasn't fixed in the last M2.1.4, I'm losing the will to live!

@sheldmandu
Copy link

Any idea when this will be fixed? Hoping 2.1.5?

@ghost
Copy link

ghost commented Mar 2, 2017

For users with locale set to EN_GB this is still an issue ALL reports fail in the backend.

This needs fixing asap as we are having to run reports in other ways and they are inefficient.

On 2.1.4
a:4:{i:0;s:38:"Invalid input date format '28/02/2017'";i:1;s:6182:"#0 /public_html/vendor/magento/zendframework1/library/Zend/Filter.php(114): Magento\Framework\Stdlib\DateTime\Filter$

@janeblonde
Copy link

Does anyone have a quick fix for this?

@janeblonde
Copy link

anyone know of a fix?

@ahbyass
Copy link

ahbyass commented Apr 19, 2017

Not a permanent fix, but if you change the date order once selected to mm/dd/yyyy the reports run fine.

@janeblonde
Copy link

@AlexanderBMAS unfortunately my client won't go for that type of work around

@rahuldhameliya
Copy link

rahuldhameliya commented Apr 27, 2017

anyone got solution?

@janeblonde
Copy link

I reported this issue back in September last year, I wasn't the first. I hope I'm wrong but it would seem that Magento have no plans that I know to fix this.

@rahuldhameliya
Copy link

Quick fix:
/vendor/magento/module-reports/Block/Adminhtml/Filter/Form.php
Replace line No .159 and 172

'date_format' => $dateFormat, to 'date_format' => 'mm/dd/Y',

@marcosdsdba
Copy link

marcosdsdba commented Apr 27, 2017

@sheldmandu @pitangaweb
I performed the tests and the error persists in versions 2.1.5 and 2.1.6

@sopedro
Copy link

sopedro commented Apr 28, 2017

For reports the workaround works but for birthdate no.

@rahuldhameliya
Copy link

@sopedro post your error here

@sopedro
Copy link

sopedro commented Apr 28, 2017

"invalid Date" in backend

@rahuldhameliya
Copy link

rahuldhameliya commented Apr 29, 2017

@sopedro which admin interface you are using?
if you will change admin interface locale from UK to US than might issue will be resolved.for reports don't need to change below fix if changing admin interface locale to US.

/vendor/magento/module-reports/Block/Adminhtml/Filter/Form.php
Replace line No .159 and 172

'date_format' => $dateFormat, to 'date_format' => 'mm/dd/Y',

@sopedro
Copy link

sopedro commented Apr 29, 2017

I'm using portuguese admin interface.
The fix is changing core files.

@marcosdsdba
Copy link

@sopedro It actually solves the problem, I have tested. The problem occurs when you choose the language for the user of the Admin Panel. Idiom locale that have the format dd-mm-Y have a problem because the Zend Class it expects mm-dd-Y.
But changing Core files is not a good practice. We have to try a solution. I am performing tests overlapping Core files to solve this problem.As it is said in Brazil this is a "Gambiarra"

@marcosdsdba
Copy link

I solved the problem by overwriting the class, creating a separate module and injecting as "prefer" from the Magento Class to the Class I created by overwriting as needed.

Anyone who wants to use the solution is available on Github:
https://github.com/MattBidas/magento2-reports

@truedaz
Copy link

truedaz commented Jun 8, 2017

Im having this same issue that the datepicker on sales > orders enters the date in UK format (correct for me). But this stops reports working. The date can be entererred manually to fix the issue.

Then I realised that a different ADMIN USER does not have the same issue. I dont know why but on the same computer and browser one user works, the others do not. I hope this helps fix the issue

@tobias-forkel
Copy link
Contributor

tobias-forkel commented Jul 31, 2017

In 2.1.1 we were able to fix the problem by updating the interface_locale back to en_US for all affected admin users.

UPDATE admin_user SET interface_locale = 'en_US' WHERE interface_locale = 'en_AU';

Clearly not a permanent solution, but better then the error.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Component: Translation labels Sep 11, 2017
@selusi
Copy link

selusi commented Sep 11, 2017

The bug is client side because on server side all date format are correct.
When You use datepicker in admin panel It is overridden by
vendor\magento\magento2-base\lib\web\mage\calendar.js
that dosen't recive the datepicker inizialization and so show always the current date, but if you inspect the code, by using Firebug, the input value of the field is correct, so It is only a presentational issue.
Furthermore, in the file
vendor\magento\module-ui\view\base\web\js\lib\validation\rules.js
the rule validate-date is not localized and so accept only mm/dd/yyyy date format, therefore, if you use a different date format on locale basis the validator give an error message.
This appen on Date of Birthday field of the customer-module, but I belive that is e general bug.
Sincerly I don't know how to solve this critical issue.

The only way to work smoothly is to set up the administrator user's locale in a language that uses mm / dd / yyyy format as an English language.

@magento-engcom-team
Copy link
Contributor

@pitangaweb, thank you for your report.
The issue is already fixed in 2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Translation Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests