diff --git a/Classes/PHPExcel/Calculation/DateTime.php b/Classes/PHPExcel/Calculation/DateTime.php index 6eb96fd2..56c14079 100644 --- a/Classes/PHPExcel/Calculation/DateTime.php +++ b/Classes/PHPExcel/Calculation/DateTime.php @@ -1071,7 +1071,9 @@ class PHPExcel_Calculation_DateTime { public static function DAYOFMONTH($dateValue = 1) { $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue); - if (is_string($dateValue = self::_getDateValue($dateValue))) { + if ($dateValue === null) { + $dateValue = 1; + } elseif (is_string($dateValue = self::_getDateValue($dateValue))) { return PHPExcel_Calculation_Functions::VALUE(); } elseif ($dateValue == 0.0) { return 0; @@ -1114,7 +1116,9 @@ class PHPExcel_Calculation_DateTime { } $style = floor($style); - if (is_string($dateValue = self::_getDateValue($dateValue))) { + if ($dateValue === null) { + $dateValue = 1; + } elseif (is_string($dateValue = self::_getDateValue($dateValue))) { return PHPExcel_Calculation_Functions::VALUE(); } elseif ($dateValue < 0.0) { return PHPExcel_Calculation_Functions::NaN(); @@ -1180,7 +1184,9 @@ class PHPExcel_Calculation_DateTime { } $method = floor($method); - if (is_string($dateValue = self::_getDateValue($dateValue))) { + if ($dateValue === null) { + $dateValue = 1; + } elseif (is_string($dateValue = self::_getDateValue($dateValue))) { return PHPExcel_Calculation_Functions::VALUE(); } elseif ($dateValue < 0.0) { return PHPExcel_Calculation_Functions::NaN(); @@ -1216,7 +1222,9 @@ class PHPExcel_Calculation_DateTime { public static function MONTHOFYEAR($dateValue = 1) { $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue); - if (is_string($dateValue = self::_getDateValue($dateValue))) { + if ($dateValue === null) { + $dateValue = 1; + } elseif (is_string($dateValue = self::_getDateValue($dateValue))) { return PHPExcel_Calculation_Functions::VALUE(); } elseif ($dateValue < 0.0) { return PHPExcel_Calculation_Functions::NaN(); @@ -1245,7 +1253,9 @@ class PHPExcel_Calculation_DateTime { public static function YEAR($dateValue = 1) { $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue); - if (is_string($dateValue = self::_getDateValue($dateValue))) { + if ($dateValue === null) { + $dateValue = 1; + } elseif (is_string($dateValue = self::_getDateValue($dateValue))) { return PHPExcel_Calculation_Functions::VALUE(); } elseif ($dateValue < 0.0) { return PHPExcel_Calculation_Functions::NaN();