mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Fix to make sure that the index respects the fiscal year.
This commit is contained in:
@@ -24,6 +24,7 @@ namespace FireflyIII\Support;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\FiscalHelperInterface;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
@@ -583,7 +584,6 @@ class Navigation
|
||||
'1W' => 'endOfWeek',
|
||||
'1M' => 'endOfMonth',
|
||||
'3M' => 'lastOfQuarter',
|
||||
'1Y' => 'endOfYear',
|
||||
'custom' => 'startOfMonth', // this only happens in test situations.
|
||||
];
|
||||
$end = clone $start;
|
||||
@@ -604,6 +604,15 @@ class Navigation
|
||||
|
||||
return $end;
|
||||
}
|
||||
|
||||
// make sure 1Y takes the fiscal year into account.
|
||||
if ('1Y' === $range) {
|
||||
/** @var FiscalHelperInterface $fiscalHelper */
|
||||
$fiscalHelper = app(FiscalHelperInterface::class);
|
||||
return $fiscalHelper->endOfFiscalYear($end);
|
||||
}
|
||||
|
||||
|
||||
throw new FireflyException(sprintf('updateEndDate cannot handle range "%s"', $range));
|
||||
}
|
||||
|
||||
@@ -622,7 +631,6 @@ class Navigation
|
||||
'1W' => 'startOfWeek',
|
||||
'1M' => 'startOfMonth',
|
||||
'3M' => 'firstOfQuarter',
|
||||
'1Y' => 'startOfYear',
|
||||
'custom' => 'startOfMonth', // this only happens in test situations.
|
||||
];
|
||||
if (isset($functionMap[$range])) {
|
||||
@@ -641,6 +649,14 @@ class Navigation
|
||||
|
||||
return $start;
|
||||
}
|
||||
|
||||
// make sure 1Y takes the fiscal year into account.
|
||||
if ('1Y' === $range) {
|
||||
/** @var FiscalHelperInterface $fiscalHelper */
|
||||
$fiscalHelper = app(FiscalHelperInterface::class);
|
||||
return $fiscalHelper->startOfFiscalYear($start);
|
||||
}
|
||||
|
||||
throw new FireflyException(sprintf('updateStartDate cannot handle range "%s"', $range));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user