You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found bug with date&time formatting.
I set timezone to UTC (php.ini, yii config) and locale to en_US in my application.
When I use time placeholder in translations I always get wrong result. But when I use formatter class I get what I expected.
I debugged Yii code and found that translations is using MessageFormatter class, but Formatter->asTime is using IntlDateFormatter.
And looks like MessageFormatter class does not takes in account timezone.
Code:
var_dump(date("g:i A"));
var_dump(\Yii::$app->formatter->asTime(time(), 'short'));
var_dump(\Yii::t('time', '{0, time, short}', time()));
related to #4960 do not have an idea for a solution right now. Afaik the intl MessageFormatter has no option to configure the builtin number and date formatters.
I found bug with date&time formatting.
I set timezone to UTC (php.ini, yii config) and locale to en_US in my application.
When I use time placeholder in translations I always get wrong result. But when I use formatter class I get what I expected.
I debugged Yii code and found that translations is using MessageFormatter class, but Formatter->asTime is using IntlDateFormatter.
And looks like MessageFormatter class does not takes in account timezone.
Code:
Result:
I know it's not a Yii bug, but maybe this bug can be resolved on framework level.
Versions:
PHP: 5.4.16
ICU: 49.1.2
Issue related to PHP 5.2:
https://bugs.php.net/bug.php?id=58756
The text was updated successfully, but these errors were encountered: