File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 33use Config ;
44use Maatwebsite \Excel \Readers \HTML_reader ;
55use \PHPExcel_Shared_Date ;
6+ use \PHPExcel_Style_NumberFormat ;
67
78/**
89 * Laravel wrapper for PHPEXcel
@@ -804,11 +805,21 @@ private function parseCells()
804805 // If the cell is a date time and we want to parse them
805806 if ($ this ->formatDates !== false && PHPExcel_Shared_Date::isDateTime ($ this ->cell ))
806807 {
807- // Convert excel time to php date object
808- $ value = PHPExcel_Shared_Date::ExcelToPHPObject ($ this ->cell ->getCalculatedValue ());
809-
810808 // Format the date
811- $ value = $ value ->format ($ this ->dateFormat );
809+ if ($ this ->formatDates !== false )
810+ {
811+ $ value = PHPExcel_Shared_Date::ExcelToPHPObject ($ this ->cell ->getCalculatedValue ());
812+ $ value = $ value ->format ($ this ->dateFormat );
813+ }
814+ else {
815+ $ value = (string ) PHPExcel_Style_NumberFormat::toFormattedString (
816+ $ this ->cell ->getCalculatedValue (),
817+ $ this ->cell ->getWorksheet ()->getParent ()
818+ ->getCellXfByIndex ($ this ->cell ->getXfIndex ())
819+ ->getNumberFormat ()
820+ ->getFormatCode ()
821+ );
822+ }
812823
813824 if ($ this ->useCarbon )
814825 {
You can’t perform that action at this time.
0 commit comments