<?= Select2::widget([
'name' => 'year-filter',
'data' => array_combine(range(date('Y') - 5, date('Y') + 5), range(date('Y') - 5, date('Y') + 5)),
- 'options' => ['placeholder' => 'Год', 'id' => 'year'],
- 'pluginOptions' => ['allowClear' => true],
+ 'value' => (string)date('Y'),
+ 'options' => [
+ 'placeholder' => 'Год',
+ 'id' => 'year',
+ ],
+ 'pluginOptions' => [
+ 'allowClear' => true,
+ ],
]) ?>
</div>
<div class="col-md d-flex">
<?= Select2::widget([
'name' => 'week-filter',
'data' => array_combine(range(1, 53), range(1, 53)),
- 'options' => ['placeholder' => 'Неделя', 'id' => 'week'],
- 'pluginOptions' => ['allowClear' => true],
+ 'value' => (date('W') + 8) > 53 ? (date('W') + 8 - 53) : (date('W') + 8),
+ 'options' => [
+ 'placeholder' => 'Неделя',
+ 'id' => 'week',
+ ],
+ 'pluginOptions' => [
+ 'allowClear' => true,
+ ],
]) ?>
</div>
<div class="col-md d-flex">