zhuravljov / yii2-datetime-widgets
Datetime widgets for Yii2.
Installs: 105 791
Dependents: 5
Suggesters: 0
Security: 0
Stars: 21
Watchers: 4
Forks: 5
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.5.0
- bower-asset/bootstrap-datepicker: *
- bower-asset/bootstrap-daterangepicker: *
- bower-asset/moment: *
- bower-asset/smalot-bootstrap-datetimepicker: *
- yiisoft/yii2: ~2.0.0
- yiisoft/yii2-bootstrap: ~2.0.0
README
Installation
The preferred way to install this extension is through composer.
Add
"zhuravljov/yii2-datetime-widgets" : "~1.1.0"
to the require section of your application's composer.json
file.
DatePicker
Demo from the bootstrap-datepicker plugin website.
Usage
<?= $form->field($model, 'attribute')->widget(DatePicker::class, [ 'clientOptions' => [ 'format' => 'dd.mm.yyyy', 'language' => 'ru', 'autoclose' => true, 'todayHighlight' => true, ], 'clientEvents' => [], ]) ?>
DateTimePicker
Demo from the bootstrap-datetimepicker plugin website.
Usage
<?= $form->field($model, 'attribute')->widget(DateTimePicker::class, [ 'clientOptions' => [ 'format' => 'dd.mm.yyyy hh:ii', 'language' => 'ru', 'autoclose' => true, ], 'clientEvents' => [], ]) ?>
DateRangePicker
Demo from the bootstrap-daterangepicker plugin website.
Usage
<?= $form->field($model, 'actual_time')->widget(DateRangePicker::class, [ 'clientOptions' => [ 'locale' => [ 'format' => 'YYYY-MM-DD', 'separator' => ' - ', ], 'ranges' => [ 'Today' => [ new JsExpression('moment()'), new JsExpression('moment()'), ], 'Yesterday' => [ new JsExpression('moment().subtract(1, "days")'), new JsExpression('moment().subtract(1, "days")'), ], ], ], 'clientEvents' => [], ]) ?>