@props([ 'month' => null, 'year' => null, 'selected' => null, ]) @php $month = (int) ($month ?? now()->month); $year = (int) ($year ?? now()->year); $start = \Carbon\Carbon::create($year, $month, 1)->startOfWeek(\Carbon\Carbon::MONDAY); $end = \Carbon\Carbon::create($year, $month, 1)->endOfMonth()->endOfWeek(\Carbon\Carbon::SUNDAY); $days = []; for ($d = $start->copy(); $d->lte($end); $d->addDay()) { $days[] = $d->copy(); } $selectedDate = $selected ? \Carbon\Carbon::parse($selected)->toDateString() : null; $label = \Carbon\Carbon::create($year, $month, 1)->translatedFormat('F Y'); @endphp
class('w-full max-w-sm rounded-xl bg-krikkit-surface p-3') }} >

{{ $label }}

@foreach (['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'] as $dow) {{ $dow }} @endforeach
@foreach ($days as $day) @php $inMonth = $day->month === $month; $iso = $day->toDateString(); @endphp @endforeach