Bootstrap Datepicker extension for Yii2
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist modernkernel/yii2-datetimepicker "*"
or add
"modernkernel/yii2-datetimepicker": "*"
to the require section of your composer.json
file.
Once the extension is installed, simply use it in your code:
Using a model with a basic preset:
<?=
$form->field($model, 'subject')->widget(\modernkernel\datetimepicker\DateTimePicker::className(), [
'options'=>['class'=>'form-control'],
'clientOptions'=>[
//'format'=>'MM/DD/YYYY H:mm',
//'stepping'=>15,
//'minDate'=>new \yii\web\JsExpression('new Date()')
]
])
?>
Comments