summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
authorPieter Eendebak <pieter.eendebak@gmail.com>2023-03-20 08:59:59 +0100
committerGitHub <noreply@github.com>2023-03-20 08:59:59 +0100
commit1cf882248961a5d411c55d75bff190d7f7eb30e2 (patch)
treee38f6322e7ab3d5c92c4334d8c62a0e2e96165f5 /numpy/core/src
parentee12ff3228d0d800dc25004bc57c78814a48df47 (diff)
downloadnumpy-1cf882248961a5d411c55d75bff190d7f7eb30e2.tar.gz
BUG: Fix busday_count for reversed dates (#23229)
Fixes #23197
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/multiarray/datetime_busday.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/datetime_busday.c b/numpy/core/src/multiarray/datetime_busday.c
index d3e9e1451..93ed0972e 100644
--- a/numpy/core/src/multiarray/datetime_busday.c
+++ b/numpy/core/src/multiarray/datetime_busday.c
@@ -365,6 +365,7 @@ apply_business_day_count(npy_datetime date_begin, npy_datetime date_end,
npy_datetime *holidays_begin, npy_datetime *holidays_end)
{
npy_int64 count, whole_weeks;
+
int day_of_week = 0;
int swapped = 0;
@@ -386,6 +387,10 @@ apply_business_day_count(npy_datetime date_begin, npy_datetime date_end,
date_begin = date_end;
date_end = tmp;
swapped = 1;
+ // we swapped date_begin and date_end, so we need to correct for the
+ // original date_end that should not be included. gh-23197
+ date_begin++;
+ date_end++;
}
/* Remove any earlier holidays */