add support for dates with XLSX writer (fixes #797)

This adds support for writing DateTime and DateTimeImmutable values with
the XLSX writer. The dates are written using the date type (t="d") which
must then specify an ISO date as the value (as opposed to a linear date
in previous versions).
This commit is contained in:
Rhodri Pugh committed 2021-05-25 16:33:54 +01:00
1 parent 3f67dbe66f
commit 1cacb57cf1
2 files changed
+3 -1

No files matched your search

+1 -1
View File
@@ -365,7 +365,7 @@ class WriterTest extends TestCase
{
$fileName = 'test_add_row_should_support_multiple_types_of_data.xlsx';
$dataRows = $this->createRowsFromValues([
['xlsx--11', true, '', 0, 10.2, null],
['xlsx--11', true, '', 0, 10.2, null, new \DateTime('2021-01-01'), new \DateTimeImmutable('2021-02-02')],
]);
$this->writeToXLSXFile($dataRows, $fileName, $shouldUseInlineStrings = false);