// Format dates for display as labels on the x-axis
- $labels = $visits->keys()->map(function ($label, $index) use ($period) {
+ $labels = $visits->keys()->map(function ($label, $index) use ($period, $mode) {
return match ($period) {
'day' => Carbon::parse($label)->isoFormat('DD'), // Convert YYYY-MM-DD string from API into zero-padded day alone
- 'month' => Carbon::parse($label)->isoFormat('MMM'), // Convert to abbreviated month name
+ 'month' => $mode === 'overview' ? Carbon::parse($label)->isoFormat('MMM YYYY') : Carbon::parse($label)->isoFormat('MMM'), // Convert to abbreviated month name (including year when showing all months)
default => $label,
};
})->toArray();
// Format dates for display in the tooltip title
$formatted_dates = $visits->keys()->map(function ($label, $index) use ($period) {
- return match ($period) {
- 'day' => Carbon::parse($label)->isoFormat('dddd Do MMMM YYYY'),