From 79c206547141b8482a2309f5f00ff466cd05f95d Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 19 May 2023 05:43:50 +0200 Subject: [PATCH] fix: Add relevant periods to addPeriod --- app/Support/Navigation.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index 5292a430d9..cb55fb25f1 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -65,6 +65,14 @@ class Navigation 'yearly' => 'addYears', '1Y' => 'addYears', 'custom' => 'addMonths', // custom? just add one month. + // last X periods? Jump the relevant month / quarter / year + 'last7' => 'addDays', + 'last30' => 'addMonths', + 'last90' => 'addMonths', + 'last365' => 'addYears', + 'MTD' => 'addMonths', + 'QTD' => 'addMonths', + 'YTD' => 'addYears', ]; $modifierMap = [ 'quarter' => 3, @@ -72,6 +80,9 @@ class Navigation 'quarterly' => 3, '6M' => 6, 'half-year' => 6, + 'last7' => 7, + 'last90' => 3, + 'QTD' => 3, ]; if (!array_key_exists($repeatFreq, $functionMap)) {