From d591d258f1326b5dbdbf22d36d962ccbd7bee65c Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 19:57:41 +0100 Subject: [PATCH] Fix null return by returning 0 --- htdocs/core/lib/date.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index c7d70249b9b..30431f10f27 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -1005,7 +1005,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', * @param int $timestampEnd Timestamp end UTC * @param int $lastday Last day is included, 0: no, 1:yes * @return int Number of days - * @seealso num_public_holiday(), num_open_day() + * @see also num_public_holiday(), num_open_day() */ function num_between_day($timestampStart, $timestampEnd, $lastday = 0) { @@ -1016,6 +1016,8 @@ function num_between_day($timestampStart, $timestampEnd, $lastday = 0) $bit = 1; } $nbjours = (int) floor(($timestampEnd - $timestampStart) / (60 * 60 * 24)) + 1 - $bit; + } else { + $nbjours = 0; } //print ($timestampEnd - $timestampStart) - $lastday; return $nbjours;