-
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
Magento\Framework\Stdlib\DateTime\TimezoneInterface broken for English(United Kingdom) locale #10663
Comments
The module I used to prove concept can be downloaded from It can be invoked by
|
Possibly related to #10580 |
@gwharton thank you for your bug report. |
Please note this is present on 2.1 and 2.2, and presumably 2.3 aswell. |
@ishakhsuvarov This bug has been marked as done, but it is not fixed in 2.2-develop. To reproduce Install Magento 2.2-develop Here i run it with three different timezones with the en_US locale
Now i run it again with three different timezones with the en_GB locale
|
@gwharton I guess I moved it to done since linked PR was merged. Moved to To Do again. |
I am working on this at #dmcdindia |
I think this issue is exposing an underlying problem in the way Magento handles dates and times. If I set the locale to en_US and call \Magento\Framework\Stdlib\DateTime\DateTime::date() it returns 2018-05-26 11:45:58 If I set the locale to en_GB and call \Magento\Framework\Stdlib\DateTime\DateTime::date() it returns 2018-05-26 11:46:05 So, DateTime::date() returns the same format regardless of locale. However \Magento\Framework\Stdlib\DateTime\Timezone::date() is expecting time strings in different formats depending on the locale. If I look at the IntlDateFormatter object within Timezone::date() and query what date pattern it is expecting then I get the following If the locale is set to en_US the pattern is expecting to be "M/d/yy, h:mm a" (Note that neither of the above patterns match what the time format returned by \Magento\Framework\Stdlib\DateTime\DateTime::date(), although the en_US pattern returns the correct result when it parses the above time string) So, should the \Magento\Framework\Stdlib\DateTime\DateTime::date() function always return the same format regardless of locale, or should it return a locale specific format or should \Magento\Framework\Stdlib\DateTime\Timezone::date() function always expect the same input time format regardless of locale, or should it accept locale specific time formats. Too much for my brain I am afraid, as I would imagine whatever you choose, would have massive impact on everything else. |
Seriously? This is still open? And does the Timezone class really return getDateTimeFormat as space-concatenated getDateFormat and getTimeFormat? While expecting the passed pattern that might use comma and space? Or a totally different formatting? |
Preconditions
Steps to reproduce
Expected result
Actual result
Set locale to English (United Kingdom)
Set locale to English (United States)
The text was updated successfully, but these errors were encountered: