diff options
author | Pieter Eendebak <pieter.eendebak@gmail.com> | 2023-03-20 08:59:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-20 08:59:59 +0100 |
commit | 1cf882248961a5d411c55d75bff190d7f7eb30e2 (patch) | |
tree | e38f6322e7ab3d5c92c4334d8c62a0e2e96165f5 /numpy/core/src | |
parent | ee12ff3228d0d800dc25004bc57c78814a48df47 (diff) | |
download | numpy-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.c | 5 |
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 */ |