codenix-sv / yii2-flatpickr
Lightweight and powerful datetimepicker for Yii2 Framework
Installs: 1 301
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 3
Open Issues: 2
Type:yii2-extension
Requires
- php: >=7.0
- npm-asset/flatpickr: ~4.0
- yiisoft/yii2: ~2.0.0
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2024-11-19 03:08:22 UTC
README
This is Yii2 widget wrapper for Flatpickr datetime picker. Flatpickr is a lightweight and powerful datetime picker written in vanilla javascript.
Latest release
The latest stable version of the extension is v2.0
Installation
The preferred way to install this extension is through composer.
Either run
$ composer require codenix-sv/yii2-flatpickr:~2.0
or add
"codenix-sv/yii2-flatpickr" : "~2.0"
to the require section of your application's composer.json
file.
Basic usage
Example of use with an ActiveForm
:
<?php use codenixsv\flatpickr\Flatpickr; ?> ... <?= $form->field($model, 'date')->widget(Flatpickr::class) ?>
Example of use as a widget:
<?= Flatpickr::widget(['model' => $model, 'attribute' => 'email']) ?>
Usage with options
<?php use codenixsv\flatpickr\Flatpickr; ?> ... <?= $form->field($model, 'email')->widget(Flatpickr::class, [ 'theme' =>'dark', 'clientOptions' => [ 'locale' => 'ru', 'enableTime' => true ] ]) ?>
Further Information
Please, check the Flatpickr site documentation for further information about configuration options.
License
yii2-flatpickr is released under the MIT License. See the bundled LICENSE for details.