mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-20 21:43:08 -06:00
Code fix for #172.
This commit is contained in:
parent
9f24f765ea
commit
87f14617cc
@ -175,10 +175,13 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
/** @var FiscalHelperInterface $fiscalHelper */
|
/** @var FiscalHelperInterface $fiscalHelper */
|
||||||
$fiscalHelper = app('FireflyIII\Helpers\FiscalHelperInterface');
|
$fiscalHelper = app('FireflyIII\Helpers\FiscalHelperInterface');
|
||||||
$start = clone $date;
|
$start = clone $date;
|
||||||
|
$start->startOfMonth();
|
||||||
$end = Carbon::now();
|
$end = Carbon::now();
|
||||||
|
$end->endOfMonth();
|
||||||
$months = [];
|
$months = [];
|
||||||
|
|
||||||
while ($start <= $end) {
|
while ($start <= $end) {
|
||||||
|
// current year:
|
||||||
$year = $fiscalHelper->endOfFiscalYear($start)->year;
|
$year = $fiscalHelper->endOfFiscalYear($start)->year;
|
||||||
|
|
||||||
if (!isset($months[$year])) {
|
if (!isset($months[$year])) {
|
||||||
@ -193,6 +196,7 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
|
|
||||||
$currentEnd = clone $start;
|
$currentEnd = clone $start;
|
||||||
$currentEnd->endOfMonth();
|
$currentEnd->endOfMonth();
|
||||||
|
|
||||||
$months[$year]['months'][] = [
|
$months[$year]['months'][] = [
|
||||||
'formatted' => $start->formatLocalized('%B %Y'),
|
'formatted' => $start->formatLocalized('%B %Y'),
|
||||||
'start' => $start->format('Y-m-d'),
|
'start' => $start->format('Y-m-d'),
|
||||||
@ -200,7 +204,10 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
'month' => $start->month,
|
'month' => $start->month,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
];
|
];
|
||||||
$start->addMonth();
|
|
||||||
|
// to make the hop to the next month properly:
|
||||||
|
$start = clone $currentEnd;
|
||||||
|
$start->addDay();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $months;
|
return $months;
|
||||||
|
Loading…
Reference in New Issue
Block a user