mitalcoi / yii2-datetime-widgets
Datetime widgets for Yii2.
Installs: 954
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 5
Language:JavaScript
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-11-09 16:58:30 UTC
README
Installation
The preferred way to install this extension is through composer.
Add
"mitalcoi/yii2-datetime-widgets" : "dev-master"
to the require section of your application's composer.json
file.
DatePicker
Demo from the bootstrap-datepicker plugin website.
Usage
use mitalcoi\widgets\DatePicker;
<?= $form->field($model, 'attribute')->widget(DatePicker::className(), [ 'options' => ['class' => 'form-control'], 'clientOptions' => [ 'format' => 'dd.mm.yyyy', 'language' => 'ru', 'autoclose' => true, 'todayHighlight' => true, ], ]) ?>
For more details, please check the bootstrap-datepicker plugin website.
DateTimePicker
Demo from the bootstrap-datetimepicker plugin website.
Usage
use mitalcoi\widgets\DateTimePicker;
<?= $form->field($model, 'attribute')->widget(DateTimePicker::className(), [ 'options' => ['class' => 'form-control'], 'clientOptions' => [ 'format' => 'dd.mm.yyyy hh:ii', 'language' => 'ru', 'autoclose' => true, ], ]) ?>
For more details, please check the bootstrap-datetimepicker plugin website.
DateRangePicker
Demo from the bootstrap-daterangepicker plugin website.
Usage
use mitalcoi\widgets\DateRangePicker;
<?= $form->field($model, 'actual_time')->widget(DateRangePicker::className(), [ 'options' => ['class' => 'form-control'], 'clientOptions' => [ 'ranges' => [ 'Today' => [ new JsExpression('moment()'), new JsExpression('moment()'), ], 'Yesterday' => [ new JsExpression('moment().subtract("days", 1)'), new JsExpression('moment().subtract("days", 1)'), ], ], 'format' => 'DD.MM.YYYY', 'separator' => ' - ', ], ]) ?>
For more details, please check the bootstrap-daterangepicker plugin repo.