We are going to deploy the new yiiframework.com website on March 23, 2018 from 8:00 to 12:00 UTC.
Website and Yii documentation will not be available in this time frame. Check the news for more details.

Yii 2.0: yii2-flatpickr

Datetime picker widget for Yii2 framework

Yii2 Flatpickr


Flatpickr is a lightweight and powerful datetime picker.


The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist beaten-sect0r/yii2-flatpickr "*"

or add

"beaten-sect0r/yii2-flatpickr": "*"

to the require section of your composer.json file.


use bs\Flatpickr\Widget as Flatpickr;
<?= $form->field($model, 'published_at')->widget(Flatpickr::className(), [
    'locale' => strtolower(substr(Yii::$app->language, 0, 2)),
    'options' => [
        'class' => 'form-control',
    'clientOptions' => [
        // config options https://chmln.github.io/flatpickr/options/
        'allowInput' => true,
        'defaultDate' => $model->published_at ? date(DATE_ATOM, $model->published_at) : null,
        'enableTime' => true,
        'time_24hr' => true,
]) ?>

Total 2 comments

#20113 report it
Beaten_Sect0r at 2017/08/06 02:59pm

https://github.com/Beaten-Sect0r/yii2-flatpickr/blob/master/composer.json - no section "require-dev"

Search in your composer.json

"@dev", },
#20112 report it
samilo at 2017/08/05 03:22am
Fix it please

php composer.phar require --prefer-dist beaten-sect0r/yii2-flatpickr "*"

[Seld\JsonLint\ParsingException] "./composer.json" does not contain valid JSON Parse error on line 27: ...cker": "@dev", }, "require-dev" --------------------^ Expected: 'STRING' - It appears you have an extra trailing comma

Leave a comment

Please to leave your comment.

Create extension
No downloadable files yet