brussens / yii2-datetimepicker-widget
Bootstrap 3 DateTimePicker widget for Yii2.
Installs: 7 099
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- bower-asset/eonasdan-bootstrap-datetimepicker: ^4.17.47
- yiisoft/yii2: ^2.0.0
This package is auto-updated.
Last update: 2024-10-15 01:38:53 UTC
README
Install
Either run
php composer.phar require --prefer-dist brussens/yii2-datetimepicker-widget "*"
or add
"brussens/yii2-datetimepicker-widget": "*"
to the require section of your composer.json
file.
Options
- format - datetime format
- clientOptions - options of plugin. See http://eonasdan.github.io/bootstrap-datetimepicker/#options
Base usage:
use brussens\datetimepicker\Widget as DateTimePicker; echo $form->field($model, 'attribute')->widget(DateTimePicker::className());
Advanced usage
use brussens\datetimepicker\Widget as DateTimePicker; echo $form->field($model, 'attribute')->widget(DateTimePicker::className(), [ 'format'=>'DD-MM-YYYY HH:mm:ss', 'clientOptions' => [ 'locale' => 'ru', //If you do not want to use auto-detection 'icons' => [ 'time' => 'el-icon-time', 'date' => 'el-icon-calendar', 'up' => 'el-icon-chevron-up', 'down' => 'el-icon-chevron-down', ], 'useSeconds' => true, 'useCurrent' => true, 'sideBySide' => true ], ]);
Range usage (experimentally)
use yii\grid\GridView; use brussens\datetimepicker\RangeWidget; GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $model, 'columns' => [ //... some columns [ 'filter' => RangeWidget::widget([ 'model' => $model, 'attribute' => 'date_from', 'attributeTo' => 'date_to' ]), 'attribute' => 'created_at', 'format' => 'datetime', ], ['class' => 'yii\grid\ActionColumn'], ], ]);