nuovo/spreadsheet-reader

Precision issue on minutes

Opened this issue · 0 comments

I experienced an issue that showed me minutes wrong.

I have in an .xlsx file in a cell (formatted general) this entry "03.01.2019 16:00" (without the "), but I'm getting "03.01.2019 15:59". In the cell below i have "04.01.2019 18:00" and i get the right value.

I added one line in the SpreadsheetReader_XLSX.php file:
on line 841: $Seconds = $Seconds + 1;

// At this point time is a fraction of a day $Time = ($Value - (int)$Value); $Seconds = 0; if ($Time) { // Here time is converted to seconds // Some loss of precision will occur $Seconds = (int)($Time * 86400); $Seconds = $Seconds + 1; // I added this line }

Now i get every time right.
Please take not that i DON'T use seconds in my timestamps.