This commit is contained in:
James Cole 2023-05-06 15:29:29 +02:00
parent c72a63f218
commit 85757e1a20
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -280,6 +280,23 @@ class Navigation
return $currentEnd;
}
$result = match ($repeatFreq) {
'last7' => $currentEnd->addDays(7)->startOfDay(),
'last30' => $currentEnd->addDays(30)->startOfDay(),
'last90' => $currentEnd->addDays(90)->startOfDay(),
'last365' => $currentEnd->addDays(365)->startOfDay(),
'MTD' => $currentEnd->startOfMonth()->startOfDay(),
'QTD' => $currentEnd->firstOfQuarter()->startOfDay(),
'YTD' => $currentEnd->startOfYear()->startOfDay(),
default => null,
};
if (null !== $result) {
return $result;
}
unset($result);
if (!array_key_exists($repeatFreq, $functionMap)) {
Log::error(sprintf('Cannot do endOfPeriod for $repeat_freq "%s"', $repeatFreq));