项目作者: simialbi

项目描述 :
Datepicker widget for yii2 framework
高级语言: PHP
项目地址: git://github.com/simialbi/yii2-widget-datetimepicker.git
创建时间: 2017-10-04T11:58:18Z
项目社区:https://github.com/simialbi/yii2-widget-datetimepicker

开源协议:MIT License

下载


yii2-widget-datetimepicker

This extension provides a date, time or datetime picker widget for yii2 framework in Bootstrap 4 style. It’s based
on Tempus Dominus.

Resources

Installation

The preferred way to install this extension is through composer.

Either run

  1. $ php composer.phar require --prefer-dist simialbi/yii2-widget-datetimepicker

or add

  1. "simialbi/yii2-widget-datetimepicker": "~2.0"

to the require section of your composer.json

Example Usage

To include datepicker instance in one of your pages, call the widget like this:

  1. <?php
  2. /* @var $this yii\web\View */
  3. /* @var $model yii\base\Model */
  4. use yii\widgets\ActiveForm;
  5. use simialbi\yii2\date\Datetimepicker;
  6. $this->title = 'myForm';
  7. $this->params['breadcrumbs'][] = $this->title;
  8. ?>
  9. <div class="my-form">
  10. <?php $form = ActiveForm::begin(['id' => 'my-form']); ?>
  11. <?= $form->field($model, 'name')->textInput(['autofocus' => true]) ?>
  12. <?= $form->field($model, 'birthday')->widget(Datetimepicker::class, [
  13. 'format' => 'mm/dd/yyyy',
  14. 'type' => Datetimepicker::TYPE_COMPONENT_APPEND
  15. ]) ?>
  16. <?= $form->field($model, 'email') ?>
  17. <?php ActiveForm::end(); ?>
  18. </div>

License

yii2-widget-datetimepicker is released under MIT license. See bundled LICENSE for details.