diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php index aafa134805..d964b1e170 100644 --- a/app/Helpers/Report/ReportHelper.php +++ b/app/Helpers/Report/ReportHelper.php @@ -175,10 +175,13 @@ class ReportHelper implements ReportHelperInterface /** @var FiscalHelperInterface $fiscalHelper */ $fiscalHelper = app('FireflyIII\Helpers\FiscalHelperInterface'); $start = clone $date; - $end = Carbon::now(); - $months = []; + $start->startOfMonth(); + $end = Carbon::now(); + $end->endOfMonth(); + $months = []; while ($start <= $end) { + // current year: $year = $fiscalHelper->endOfFiscalYear($start)->year; if (!isset($months[$year])) { @@ -193,6 +196,7 @@ class ReportHelper implements ReportHelperInterface $currentEnd = clone $start; $currentEnd->endOfMonth(); + $months[$year]['months'][] = [ 'formatted' => $start->formatLocalized('%B %Y'), 'start' => $start->format('Y-m-d'), @@ -200,7 +204,10 @@ class ReportHelper implements ReportHelperInterface 'month' => $start->month, 'year' => $year, ]; - $start->addMonth(); + + // to make the hop to the next month properly: + $start = clone $currentEnd; + $start->addDay(); } return $months;