Skip to content

Commit 5cbf8d4

Browse files
author
Robert Pustułka
committed
Revert DateTime change. Add human friendly default format for datetimes.
1 parent fa5627e commit 5cbf8d4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/Excel/Manager.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,9 @@ public function attachHeader(PHPExcel_Worksheet $worksheet, array $header, array
252252
*/
253253
protected function setCellValue(PHPExcel_Cell $cell, $value)
254254
{
255-
if ($value instanceof DateTime) {
256-
$value = PHPExcel_Shared_Date::PHPToExcel($value);
255+
if ($value instanceof DateTimeInterface) {
256+
$value = PHPExcel_Shared_Date::PHPToExcel($value->format('U'));
257+
$cell->getStyle()->getNumberFormat()->setFormatCode('YYYY-MM-DD HH:MM:SS');
257258
}
258259
$cell->setValue($value);
259260
if (is_numeric($value)) {

0 commit comments

Comments
 (0)