diff --git a/src/PhpSpreadsheet/Calculation/DateTime.php b/src/PhpSpreadsheet/Calculation/DateTime.php index e042b15c..16164814 100644 --- a/src/PhpSpreadsheet/Calculation/DateTime.php +++ b/src/PhpSpreadsheet/Calculation/DateTime.php @@ -664,7 +664,7 @@ class DateTime } // Validate parameters - if ($startDate >= $endDate) { + if ($startDate > $endDate) { return Functions::NAN(); } diff --git a/tests/data/Calculation/DateTime/DATEDIF.php b/tests/data/Calculation/DateTime/DATEDIF.php index 4e2288c6..de397956 100644 --- a/tests/data/Calculation/DateTime/DATEDIF.php +++ b/tests/data/Calculation/DateTime/DATEDIF.php @@ -607,4 +607,10 @@ return [ 'Y', 50, ], + [ + '1982-12-07', + '1982-12-7', + 'D', + 0, + ], ];