mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-17 20:08:52 +00:00
Add YTD fix.
This commit is contained in:
@@ -151,13 +151,7 @@ class Navigation
|
|||||||
|
|
||||||
public function diffInPeriods(string $period, int $skip, Carbon $beginning, Carbon $end): int
|
public function diffInPeriods(string $period, int $skip, Carbon $beginning, Carbon $end): int
|
||||||
{
|
{
|
||||||
Log::debug(sprintf(
|
Log::debug(sprintf('diffInPeriods: %s (skip: %d), between %s and %s.', $period, $skip, $beginning->format('Y-m-d'), $end->format('Y-m-d')));
|
||||||
'diffInPeriods: %s (skip: %d), between %s and %s.',
|
|
||||||
$period,
|
|
||||||
$skip,
|
|
||||||
$beginning->format('Y-m-d'),
|
|
||||||
$end->format('Y-m-d')
|
|
||||||
));
|
|
||||||
$map = [
|
$map = [
|
||||||
'daily' => 'diffInDays',
|
'daily' => 'diffInDays',
|
||||||
'weekly' => 'diffInWeeks',
|
'weekly' => 'diffInWeeks',
|
||||||
@@ -211,9 +205,14 @@ class Navigation
|
|||||||
// Log::debug(sprintf('Now in endOfPeriod("%s", "%s").', $currentEnd->toIso8601String(), $repeatFreq));
|
// Log::debug(sprintf('Now in endOfPeriod("%s", "%s").', $currentEnd->toIso8601String(), $repeatFreq));
|
||||||
if ('MTD' === $repeatFreq && $end->isFuture()) {
|
if ('MTD' === $repeatFreq && $end->isFuture()) {
|
||||||
// fall back to a monthly schedule if the requested period is MTD.
|
// fall back to a monthly schedule if the requested period is MTD.
|
||||||
Log::debug('endOfPeriod() requests "MTD", set it to "1M" instead.');
|
Log::debug('endOfPeriod() requests "MTD" + future, set it to "1M" instead.');
|
||||||
$repeatFreq = '1M';
|
$repeatFreq = '1M';
|
||||||
}
|
}
|
||||||
|
if ('YTD' === $repeatFreq && $end->isFuture()) {
|
||||||
|
// fall back to a yearly schedule if the requested period is YTD.
|
||||||
|
Log::debug('endOfPeriod() requests "YTD" + future, set it to "1Y" instead.');
|
||||||
|
$repeatFreq = '1Y';
|
||||||
|
}
|
||||||
|
|
||||||
$functionMap = [
|
$functionMap = [
|
||||||
'1D' => 'endOfDay',
|
'1D' => 'endOfDay',
|
||||||
|
|||||||
Reference in New Issue
Block a user