ivan-chkv / yii2-jstimezonedetect
Yii 2 jsTimeZoneDetect Asset
Installs: 4 627
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Type:yii2-extension
Requires
- pellepim/jstimezonedetect: 1.0.*
- yiisoft/yii2: >=2.0.4
Requires (Dev)
- ivan-chkv/yii2-phpunit: 2.*
This package is not auto-updated.
Last update: 2019-02-20 18:59:31 UTC
README
Yii 2 jsTimeZoneDetect Asset
https://pellepim.bitbucket.io/jstz/
Configuration
<?php $timeZone = yii\jstimezonedetect\TimeZone::detect(); return [ 'timeZone' => $timeZone, 'components' => [ 'formatter' => ['defaultTimeZone' => $timeZone], 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=yii2advanced', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'on afterOpen' => function (yii\base\Event $event) { /* @var $db yii\db\Connection */ $db = $event->sender; $db->createCommand('SET time_zone = :timeZone;', ['timeZone' => date('P')])->execute(); } ] ] ];