-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fix admin localized date formatting #27311
Fix admin localized date formatting #27311
Conversation
Hi @tdgroot. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tdgroot Great that you've approached the issue.
Could you cover the change with Functional tests (MFTF)?
Will do! |
@lbajsarowicz I added an MFTF test to cover this PR. Please let me know if it's any good 😄. |
app/code/Magento/Ui/Test/Mftf/Test/AdminLocalizedDateElementTest.xml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you've already worked with MFTF.
Almost perfect 👏
We need to separate steps of preparing the test from actual testing:
Before
- Generate date objects
- Login as Main Admin
- Create Dutch Admin
- Logout from Main Admin
After
- Login as Main Admin
- Remove Dutch Account
- Logout from Main Admin
Test
- Login as Main Admin
- Create price rule in en_US and make assertions
- Logout from Main Admin
- Login as Dutch
- Create price rule in nl_nl and make assertions
- Logout from dutch account
That would be awesome if you find the way to remove Price Rules in After
section.
I joined the MFTF workshop with you last year in Florence at MageTestFest!
Will do!
I was thinking about that, but somehow forgot to add that. I'll add that in! |
@lbajsarowicz I added the requested changes. One thing I could not do was move the |
You are right about data scope. That is fine |
@magento-engcom-team what changes are requested? |
@tdgroot Could you fix static tests: |
@ihor-sviziev @lbajsarowicz I see the following error: The How do we go about that? To me it seems very important to be able to test the application on other locales as well. |
@lbajsarowicz could you help with the issue in MFTF? |
# Conflicts: # app/code/Magento/Ui/view/base/web/js/form/element/date.js
@ihor-sviziev I updated the branch to resolve merge conflicts. Could you let me know what the status is of this issue? |
@magento run all tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tdgroot,
Please review and fix failing tests
@lbajsarowicz @ihor-sviziev Could you help with the tests? We have to disable the NL locale in all our back-ends because it changes all dates upon saving, which is very confusing for our clients. |
Is this fixed by #31047 or just partially? |
Confirmed that this PR works. Thank you tdgroot. |
@Den4ik, maybe you could review and help with tests? |
This is related to #33591 |
Looking at #31047. This one works better and is less code change. |
But in fact it's masking of talk problem. Look at |
@tdgroot - thank you for the effort you put into this pull request! It's been out here a while - it's actually one of the oldest pull requests still open. In your opinion, is this still an issue? Pascal's comment from 2021 makes it seem like the merged pull request #31047 may also have addressed this problem. And Igor pointed out that there's failed tests that need to be addressed. What do you think, is there a need to put the additional effort into this PR to get it merged, or is it out of date now and could be closed? |
Hi @joshuaswarren, Yeah it's been a while 😅. I'm not actively developing Magento projects anymore, so I haven't been in the in the loop on this one. It could very well be the case that the problem has been solved, but I know there were multiple problems that required various fixes. It might be good to ask @barryvdh or @PascalBrouwers if this is still a problem. Anyway, last time I checked, the tests were failing because I introduced something that the test suite didn't support: multiple admin locales. So the tests change the admin user locale to |
Description (*)
There were 2 issues going on that are fixed by this PR.
When parsing the initial value, say
2020-03-17
, the date was getting parse with the following format (for nl_NL):dd-MM-y
. The value used was derived from the variableoutputDateFormat
. I changed the format by using the variableinputeDateFormat
, which isyyyy-MM-dd
.Variable
shiftedValue
was initialized by theonValueChange
listener. But when changingshiftedValue
, thevalue
variable is changed by theonShiftedValueChange
listener. This would mess up the date value as well.A cyclic event chain like the following could occur:
shiftedValue
to2020-03-17
.value
to17-03-2020
.shiftedValue
to20-03-2017
.Fixed Issues (if relevant)
Manual testing scenarios (*)
en_US
, one onnl_NL
.nl_NL
admin user.Contribution checklist (*)