Refactor ISO data type validation from cell to shared date; add extra checks for invalid dates; and appropriate unit tests

This commit is contained in:
MarkBaker
2022-02-26 13:43:35 +01:00
parent 9cf526a920
commit ef4029df63
5 changed files with 75 additions and 15 deletions
+18 -2
View File
@@ -1,5 +1,6 @@
<?php
use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
return [
@@ -39,12 +40,27 @@ return [
DataType::TYPE_NUMERIC,
],
[
'#DIV/0!',
44613.43090277778,
'2022-02-21 10:20:30',
DataType::TYPE_ISO_DATE,
],
[
44613.0,
'2022-02-21',
DataType::TYPE_ISO_DATE,
],
[
-30879.0,
'1815-06-15', // Dates outside the Excel Range should fail really
DataType::TYPE_ISO_DATE,
],
[
ExcelError::DIV0(),
'#DIV/0!',
DataType::TYPE_ERROR,
],
[
'#NULL!',
ExcelError::null(),
'NOT A VALID ERROR TYPE VALUE',
DataType::TYPE_ERROR,
],