You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a new table by importing the file. Make sure to set the column type to DateTime during import.
Expected behavior
New table content is like old table content
Actual behavior
The import fails, because the date cannot be parsed, for it is in an unexpected format:
floor(): Argument #1 ($num) must be of type int|float, string given","Code":0,"Trace":[{"file":"/srv/http/nextcloud/master/apps-repos/tables/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Date.php","line":224
In one place we run \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject() without testing the input value. The method assumes it is a float or int. More precisely it expects a Microsoft Excel timestamp like 42495.15902, but a string in the form of "2024-02-24".
Also I am not sure the detection works, either, for Date::isDateTime() is being called and it does not test for the mentioned timestamp.
Tables app version
main
Browser
No response
Client operating system
No response
Operating system
No response
Web server
None
PHP engine version
None
Database
None
Additional info
Actually, I am not sure how important it is to check for this type. It might be with xlsx formats, I have not tried it out yet. At some point, there migth be collisions between unix timestamps and MS Excel timestamps and it is not possible to tell them apart – though the file type can be taken into account.
For example, 42495 is roughly quarter to 1pm on 01.01.1970 in UNIX, but 0.00 o'clock on May 5th 2016 in Excel.
I have local changes trying to tame this to some degree, but not every case is covered yet.
The text was updated successfully, but these errors were encountered:
blizzz
added
0. Needs triage
Pending approval or rejection. This issue is pending approval.
bug
Something isn't working
1. to develop
Accepted and waiting to be taken care of
and removed
0. Needs triage
Pending approval or rejection. This issue is pending approval.
labels
Nov 5, 2024
Steps to reproduce
Datetime
fieldExpected behavior
New table content is like old table content
Actual behavior
The import fails, because the date cannot be parsed, for it is in an unexpected format:
In one place we run
\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject()
without testing the input value. The method assumes it is a float or int. More precisely it expects a Microsoft Excel timestamp like42495.15902
, but a string in the form of "2024-02-24".Also I am not sure the detection works, either, for
Date::isDateTime()
is being called and it does not test for the mentioned timestamp.Tables app version
main
Browser
No response
Client operating system
No response
Operating system
No response
Web server
None
PHP engine version
None
Database
None
Additional info
Actually, I am not sure how important it is to check for this type. It might be with xlsx formats, I have not tried it out yet. At some point, there migth be collisions between unix timestamps and MS Excel timestamps and it is not possible to tell them apart – though the file type can be taken into account.
For example,
42495
is roughly quarter to 1pm on 01.01.1970 in UNIX, but 0.00 o'clock on May 5th 2016 in Excel.I have local changes trying to tame this to some degree, but not every case is covered yet.
cc @luka-nextcloud if you have insights.
The text was updated successfully, but these errors were encountered: