PhpSpreadsheet
PhpSpreadsheet copied to clipboard
Shared\Date::isDateTime() fails
This is:
- [x] a bug report
- [ ] a feature request
- [x] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
Shared\Date::isDateTime() should return true
What is the current behavior?
Shared\Date::isDateTime() returns false
What are the steps to reproduce?
@MarkBaker ,
Since https://github.com/PHPOffice/PhpSpreadsheet/commit/432e5845e1c016699a847bcbc3e8106b1872c75f commit was merged some date type cells are reported as non-date type.
Not sure what was the reason to add the is_numeric( check but it broke the functionality, at least in my case.

In actual code, $cell->getCalculatedValue() returns a string and is_numeric() check is not passed.
In my case Shared\Date::isDateTime() doesn't return true on a date cell even when I comment out the is_numeric() condition because $activeSheet->getStyle($cell->getCoordinate())->getNumberFormat()->getFormatCode() returns "General" for some reason even though when I open the file in excel the cell value is correctly formatted to a date. $cell->getValue() returns int 45108
[edit] my bad, I forgot I was setting $reader->setReadDataOnly(TRUE)