From 62345ef4da075f16c9dbe79d8962e26f2d0d8dd7 Mon Sep 17 00:00:00 2001 From: mattkibbler Date: Mon, 17 Aug 2015 18:48:58 +0100 Subject: [PATCH] Allow start and end date of DATEDIF function to be the same --- src/PhpSpreadsheet/Calculation/DateTime.php | 2 +- tests/data/Calculation/DateTime/DATEDIF.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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, + ], ];