diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cc196f..e841d94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.0.7] - 2022-12-09 + +* Fix daily stats labels when selecting month/year. + ## [3.0.6] - 2022-06-24 * Add description column to Redirects overview. diff --git a/controllers/Statistics.php b/controllers/Statistics.php index 31f5e08..a0f6183 100644 --- a/controllers/Statistics.php +++ b/controllers/Statistics.php @@ -56,7 +56,7 @@ public function onLoadHitsPerDay(): array $this->getHitsPerDayAsDataSet((int) $month, (int) $year, true), $this->getHitsPerDayAsDataSet((int) $month, (int) $year, false), ], JSON_THROW_ON_ERROR), - 'labels' => json_encode($this->getLabels(), JSON_THROW_ON_ERROR), + 'labels' => json_encode($this->getLabels((int) $month, (int) $year), JSON_THROW_ON_ERROR), 'monthYearOptions' => $this->helper->getMonthYearOptions(), 'monthYearSelected' => $month . '_' . $year, ]), @@ -125,11 +125,11 @@ public function onLoadScoreBoard(): array ]; } - private function getLabels(): array + private function getLabels(int $month, int $year): array { $labels = []; - foreach (Carbon::today()->firstOfMonth()->daysUntil(Carbon::today()->endOfMonth()) as $date) { + foreach (Carbon::create($year, $month)->firstOfMonth()->daysUntil(Carbon::create($year, $month)->endOfMonth()) as $date) { $labels[] = $date->isoFormat('LL'); } diff --git a/updates/version.yaml b/updates/version.yaml index 29fa151..91d545e 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -74,3 +74,4 @@ v3.0.3: "Update plugin dependencies" v3.0.4: "Improved compatibility/extensibility with other Plugins." v3.0.5: "Lock to October CMS version 2.x. Support for October CMS 3 will be added in v3.1.0." v3.0.6: "Add description column to Redirects overview." +v3.0.7: "Fix daily stats labels when selecting month/year."