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

v2.0.0 2020-03-18 17:00 UTC

This package is auto-updated.

Last update: 2024-11-19 03:08:22 UTC


README

Build Status Maintainability Test Coverage Scrutinizer Code Quality Code Coverage

License Latest Stable Version

This is Yii2 widget wrapper for Flatpickr datetime picker. Flatpickr is a lightweight and powerful datetime picker written in vanilla javascript.

flatpickr-theme flatpickr-theme-dark

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.