jino5577 / yii2-date-range-picker
基于 Dan Grossman daterangepicker 插件的 Yii 2 日期范围选择器输入。
1.0.0
2015-10-15 08:52 UTC
Requires
- bower-asset/bootstrap-daterangepicker: @stable
This package is not auto-updated.
Last update: 2024-09-14 18:09:41 UTC
README
基于 Dan Grossman 的 bootstrap-daterangepicker 的 Yii Framework 2 日期范围选择器输入。
功能
-
可以使用 MaskedInput 手动输入日期范围。
-
自版本 2.0.8 以来,daterangepicker 插件可以接受空初始值。为此,将插件选项
autoUpdateInput设置为false并使用默认的callback选项。有关详细信息,请参阅 https://github.com/dangrossman/bootstrap-daterangepicker/issues/815。
安装
安装此扩展的首选方式是通过 composer。
要安装,请运行
$ php composer.phar require jino5577/yii2-date-range-picker "*"
或添加
"jino5577/yii2-date-range-picker": "*"
到您的 composer.json 文件的 require 部分。
用法
use jino5577\daterangepicker\DateRangePicker; echo DateRangePicker::widget([ 'model' => $model, 'attribute' => 'dateRange', // Optional. Used for calendar localization. // IF `null` (default), default moment.js language will be used. 'locale' => 'ru-RU'; // Daterange plugin options. Default is `null`. // See http://www.daterangepicker.com/#options 'pluginOptions' => [ /* ... */ 'autoUpdateInput' => false, ], // Optional. If maskOptions is set, MaskedInput will be used // instead of TextInput. Default is `null`. 'maskOptions' => [ 'mask' => '99/99/9999 - 99/99/9999', ], // Optional. Input control options, // default is `['class' => 'form-control']`. 'options' => [ /* ... */ ], // Optional. Widget template, default is `{input}`. // The special tag `{input}` will be replaced with the form input. 'template' => ' <div class="input-group"> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> {input} </div> ' ], // Optional. Javascript callback to be passed to the // plugin constructor. By default, updates the input // and triggers `change` event. 'callback' => 'function() { /* ... */ }'; ]);
许可证
BSD 3-Clause 许可证。请参阅附带的 LICENSE.md 文件以获取更多信息。