PHP code example of wdmg / yii2-datepicker

1. Go to this page and download the library: Download wdmg/yii2-datepicker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wdmg / yii2-datepicker example snippets


    
    use wdmg\widgets\DatePicker;
    ...
    
    echo DatePicker::widget([
        'model' => $model,
        'attribute' => 'datetime',
        'options' => [
           'class' => 'form-control'
        ],
        'pluginOptions' => [
            'className' => '.datepicker',
            'input' => '.form-control',
            'toggle' => '.input-group-btn > button',
        ]
        ...
    ]);
    
    

    
    use wdmg\widgets\DatePicker;
    ...
    
    $form = ActiveForm::begin();
    ...
    echo $form->field($model, 'datetime')->widget(DatePicker::class, [
        'options' => [
            'class' => 'form-control'
        ],
        'pluginOptions' => [
            'className' => '.datepicker',
            'input' => '.form-control',
            'toggle' => '.input-group-btn > button',
        ]
        ...
    ]);
    ...
    ActiveForm::end();