From 8f9b61ff35ef832a5d16724a6a8da18c448006f6 Mon Sep 17 00:00:00 2001 From: larssandergreen Date: Wed, 19 Oct 2022 13:33:20 -0600 Subject: [PATCH] Fix fiscal year end year for Jan 1 --- CRM/Utils/Date.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php index 98819be857..5873986d55 100644 --- a/CRM/Utils/Date.php +++ b/CRM/Utils/Date.php @@ -1316,11 +1316,12 @@ class CRM_Utils_Date { } else { $from['Y'] = $fYear - $relativeTermSuffix; - $fiscalYear = mktime(0, 0, 0, $from['M'], $from['d'] - 1, $from['Y'] + 1); + $fiscalYear = mktime(0, 0, 0, $from['M'], $from['d'] - 1, $from['Y'] + $relativeTermSuffix); $fiscalEnd = explode('-', date("Y-m-d", $fiscalYear)); $to['d'] = $fiscalEnd['2']; $to['M'] = $fiscalEnd['1']; - $to['Y'] = $fYear; + // We need the year from FiscalEnd, instead of just fYear, because these differ if the FY starts on Jan 1 + $to['Y'] = $fiscalEnd['0']; $to['H'] = 23; $to['i'] = $to['s'] = 59; } -- 2.25.1