Skip to content

Commit

Permalink
fix issue #1 and #2
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsmith committed Dec 7, 2022
1 parent 6af623a commit cd6a793
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,42 @@ echo $form->field($model, 'date')->widget(
?>
```


***Example of use on Gridview***
You may need to adjust the filter to work with your form or search model but this is how it is working with a default
Yii installation.

```php
<?php
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
],
]);
```

Resources Information
-------------------
Please, check the [flatpicker site](https://flatpickr.js.org/options/) documentation for further information about its configuration options.
Expand Down

0 comments on commit cd6a793

Please sign in to comment.