kolyasiryk/yii2-date-behavior

This behavior makes it easy to save and to take date in correct format.

v1.0.5 2018-05-14 10:17 UTC

This package is auto-updated.

Last update: 2024-04-14 02:34:48 UTC


README

Installation

The preferred way to install this extension is through composer. Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json.

To install, either run

$ php composer.phar require kolyasiryk/yii2-date-behavior "*"

or add

"kolyasiryk/yii2-date-behavior": "*"

to the require section of your composer.json file.

Usage

    public function behaviors()
    {
        return [
            [
                'class' => \kolyasiryk\behaviors\DateBehavior::className(),
                'datetimeDisplayFormat' => 'php:d.m.Y H:i',
                'attributes' => [
                    'start_date' => 'datetime',
                    'end_date' => 'datetime',
                ],
            ],
        ];
    }