项目作者: codenix-sv

项目描述 :
Flatpickr widget for Yii2
高级语言: PHP
项目地址: git://github.com/codenix-sv/yii2-flatpickr.git
创建时间: 2017-11-21T17:47:27Z
项目社区:https://github.com/codenix-sv/yii2-flatpickr

开源协议:MIT License

下载


Flatpickr widget for Yii2

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

  1. $ composer require codenix-sv/yii2-flatpickr:~2.0

or add

  1. "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:

  1. <?php
  2. use codenixsv\flatpickr\Flatpickr;
  3. ?>
  4. ...
  5. <?= $form->field($model, 'date')->widget(Flatpickr::class) ?>

Example of use as a widget:

  1. <?= Flatpickr::widget(['model' => $model, 'attribute' => 'email']) ?>

Usage with options

  1. <?php
  2. use codenixsv\flatpickr\Flatpickr;
  3. ?>
  4. ...
  5. <?= $form->field($model, 'email')->widget(Flatpickr::class, [
  6. 'theme' =>'dark',
  7. 'clientOptions' => [
  8. 'locale' => 'ru',
  9. 'enableTime' => true
  10. ]
  11. ]) ?>

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.