PHP code example of cgsmith / yii2-flatpickr-widget

1. Go to this page and download the library: Download cgsmith/yii2-flatpickr-widget 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/ */

    

cgsmith / yii2-flatpickr-widget example snippets



use cgsmith\flatpickr\FlatpickrWidget;

// as a widget


    echo GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            [
                'attribute' => 'created_at',
                'label' => 'Created At',
                'format' => 'datetime',
                'value' => 'created_at',
                'filter' => \cgsmith\flatpickr\FlatpickrWidget::widget(
                    [
                        'model' => $searchModel,
                        'attribute' => 'created_at',
                        'flatpickrConfig' => [
                                'enableTime' => false,
                                'dateFormat' => 'U',
                                'altInput' => true,
                                'altFormat' => 'F j, Y',
                        ],
                    ]
                )
            ],
            'updated_at:datetime',
            // other columns and settings for gridview
        ],
    ]);