[['adminGroupId'], 'in', 'range' => array_keys(AdminGroup::groupsWithShift())],
[['start', 'end'], 'date', 'format' => 'php:Y-m-d'],
[['status'], 'in' ,'range' => array_keys(Timetable::statuses())],
- [['start'], 'default', 'value' => date('Y-m-01', strtotime('next month midnight'))],
- [['end'], 'default', 'value' => date('Y-m-t', strtotime('next month midnight'))],
+ [['start'], 'default', 'value' => date('Y-m-01', strtotime('this month midnight'))],
+ [['end'], 'default', 'value' => date('Y-m-t', strtotime('this month midnight'))],
];
}
<div class="row selectgroup selectgroup-pills">
<div class="col-12">
Выбор месяца:
- <?php $selectedDate = new DateTime($tabelForm->start) ?>
- <?php for ($date = new DateTime(); $date < new DateTime('+12 month'); $date->modify('+1 month')) { ?>
+ <?php $currentMonth = new DateTime() ?>
+ <?php $selectedDate = isset($tabelForm->start) ? new DateTime($tabelForm->start) : $currentMonth; ?>
+
+ <?php for ($date = (clone $currentMonth)->modify('-1 month'); $date < new DateTime('+12 month'); $date->modify('+1 month')) { ?>
<?php $selectedAttribute = $date->format('Y-m') === $selectedDate->format('Y-m') ? ' checked' : '' ?>
<label><input
class="selectgroup-input"