Skip to content

Commit

Permalink
fix invalid config for formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
eLFuvo committed Feb 14, 2021
1 parent beb5a23 commit 19fe3c3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ to the "require" section of your `composer.json` file.
Configure
---------

In application configuration file set `defaultTimeZone` (DB time zone) and `timeZone` (application time zone)
In application configuration file set `defaultTimeZone` (DB time zone) and `timeZone` (application time zone) for
formatter

```php
[
'timeZone' => 'Europe/Moscow', // application time zone
'defaultTimeZone' => 'UTC',// data base time zone
'components' => [
'formatter' => [
'class' => \yii\i18n\Formatter::class,
'defaultTimeZone' => 'UTC', // database timezone
'timeZone' => 'Europe/Moscow', // application time zone
],
],
];
```

Expand Down
9 changes: 7 additions & 2 deletions tests/_data/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
return [
'id' => 'tests',
'timeZone' => 'Europe/Moscow', // application time zone
'defaultTimeZone' => 'UTC',// data base time zone
'language' => 'ru',
'basePath' => dirname(dirname(__DIR__)),
'aliases' => [
Expand All @@ -23,5 +22,11 @@
'definitions' => [],
],
'modules' => [],
'components' => [],
'components' => [
'formatter' => [
'class' => \yii\i18n\Formatter::class,
'defaultTimeZone' => 'UTC',
'timeZone' => 'Europe/Moscow',
],
],
];
1 change: 0 additions & 1 deletion tests/functional/DateConvertHelperCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class DateConvertHelperCest
public function _before(FunctionalTester $I)
{
new \yii\console\Application(require(dirname(__DIR__) . '/_data/config.php'));
Yii::$app->setTimeZone('Europe/Moscow');
}

// tests
Expand Down

0 comments on commit 19fe3c3

Please sign in to comment.