Skip to content

Commit 68af710

Browse files
committed
can list weekdays
1 parent 38bccf6 commit 68af710

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/Tags/Events.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Carbon\Carbon;
66
use Carbon\CarbonImmutable;
77
use Carbon\CarbonInterface;
8+
use Carbon\CarbonPeriod;
89
use Illuminate\Pagination\Paginator;
910
use Illuminate\Support\Collection;
1011
use Statamic\Contracts\Query\Builder;
@@ -47,6 +48,16 @@ public function calendar(): Collection
4748
return $this->output($this->makeEmptyDates(from: $from, to: $to)->merge($occurrences)->values());
4849
}
4950

51+
public function daysOfWeek(): Collection
52+
{
53+
return collect(CarbonPeriod::dates(now()->startOfWeek(), now()->endOfWeek()))
54+
->map(fn (Carbon $date) => [
55+
'short' => $date->format('D')[0],
56+
'medium' => $date->format('D'),
57+
'long' => $date->format('l'),
58+
]);
59+
}
60+
5061
public function downloadLink(): string
5162
{
5263
return route(

0 commit comments

Comments
 (0)