beaten-sect0r / yii2-flatpickr
Datetime picker widget for Yii2 framework
Installs: 8 279
Dependents: 2
Suggesters: 0
Security: 0
Stars: 17
Watchers: 3
Forks: 11
Open Issues: 2
Type:yii2-extension
Requires
- bower-asset/flatpickr: ^3.0
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-11-20 23:57:24 UTC
README
Click on a ⭐!
Flatpickr is a lightweight and powerful datetime picker.
Installation
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.
Usage
<?php use bs\Flatpickr\FlatpickrWidget; ?> <?= $form->field($model, 'published_at')->widget(FlatpickrWidget::class, [ 'locale' => strtolower(substr(Yii::$app->language, 0, 2)), // https://chmln.github.io/flatpickr/plugins/ 'plugins' => [ 'confirmDate' => [ 'confirmIcon'=> "<i class='fa fa-check'></i>", 'confirmText' => 'OK', 'showAlways' => false, 'theme' => 'light', ], ], 'groupBtnShow' => true, '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, ], ]) ?>