Skip to content

[Backport-2.2] of PR-#11306 Save date time correctly in different timezone and local #13560

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
wants to merge 2 commits into from
Closed

Conversation

gwharton
Copy link
Contributor

@gwharton gwharton commented Feb 8, 2018

Description

Backport of PR-#11306 into 2.2-develop

Fixed Issues (if relevant)

#10580 : Set product as new "from" and "to" not being interpreted correctly
#10485 : Error: Invalid input datetime format of value '25/07/+00201717

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@gwharton gwharton changed the title Backport of PR-#11306 Save date time correctly in different timezone and local [Backport-2.2] of PR-#11306 Save date time correctly in different timezone and local Feb 8, 2018
@okorshenko okorshenko self-assigned this Feb 8, 2018
@okorshenko okorshenko added this to the February 2018 milestone Feb 8, 2018
use Magento\Framework\Phrase;
use Magento\Framework\Stdlib\DateTime;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add an alias for DateTime or use FQCN due to Magento 2.2.x support PHP 7.0 version and this code will fail with fatal error:

Cannot use Magento\Framework\Stdlib\DateTime as DateTime because the name is already in use in /opt/bamboo/builds/MPAF-SPERFEE-CEEC/build-775/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php on line 14

This is a PHP core bug, that was fixed in 7.0.13

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for that. I wasn't aware of that bug. Is this 2.2.x specific, as the same commit was made to the 2.3-develop branch.

Fixes problem with Magento 2.2.x < PHP 7.0.13 support due to PHP core bug https://bugs.php.net/bug.php?id=66862
@magento-engcom-team
Copy link
Contributor

PR not Fixed problem.

Preconditions
Locale in Backend is set to United Kingdom.

Steps to reproduce
In Admin navigate to Product->Catalog.
Open an existing product or start to create a new one.
When all the required fields are filled fill in some date fields. For example set "Set Product as New From" 12/02/2018 "To" 01/03/2018.
Make sure the date is displayed in this very format (DD/MM/YYYY)!
Click Save button.

Expected result
The product is successfully saved. An appropriate success message appears.

Actual result
The product is not saved.
"Invalid input datetime format of value '12/02/+00201818'" message appears.

@gwharton
Copy link
Contributor Author

@magento-engcom-team I have been unable to reproduce the failure you are seeing. I am running PHP 7.1.11. What version of PHP are you testing under?

@magento-engcom-team
Copy link
Contributor

@gwharton I tested with PHP 7.0.25.

@gwharton
Copy link
Contributor Author

OK, it seems something deeper is going on here. This PR was just intended to be a copy of the fix that was previously applied to 2.3-develop in PR #11306, as a quick test on my 2.2-dev setup showed the fix to work, so either there is something different in PHP versions, or 2.2/2.3 or the original fix applied to 2.3 is not sufficient.

I'm going to withdraw this PR, as I was just replicating the work done by @raumatbel in PR #11306 into 2.2-develop, but it looks like further work may be required.

@gwharton gwharton closed this Feb 19, 2018
@gwharton gwharton deleted the 2.2-develop-10580 branch February 19, 2018 13:43
@Tomasz-Silpion
Copy link
Member

It can be still related to lib-icu php component as mentioned in #10485 (comment)

No matter what, due to Magento 2 architecture as long there's lib-icu usage dependency problem could persist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants