Description
This is:
- [X] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
All native Excel dates parsed from an Excel spreadsheet should be cast into a float.
What is the current behavior?
Native Excel dates that just so happen to be a round number end up cast into an integer, while those that are not round are correctly cast as float.
What are the steps to reproduce?
- create a new spreadsheet
- write "08/03/2020 00:00:00" into first cell
- write "07/03/2020 07:00:00" into second cell
- parse the spreadsheet
- apply getCalculatedValue() on first and second cell
- first cell's value gets typed as an integer
- second cell's value gets typed as a float
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
Not possible, the problem occurs when reading/parsing a file.
Which versions of PhpSpreadsheet and PHP are affected?
It started after 1.8.2. Sadly, i cannot be more precise than that. I was working on a stale branch with 1.8.2 when i got a ticket about an issue that ended up being caused by this bug in production. After hunting around for an hour trying to figure out what's going on, as i couldn't repro the case on my (stale) branch, i realized it might not be our code, updated my PhpSpreadsheet to 1.11.0 and the problem showed up.
We're running PHP 7.1.33