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
Output of =TEXT("09:01","HH:MM:SS") is the time string 09:01:00
Verified with Excel and LibreOffice
What is the current behavior?
Output is 00:00:00
What features do you think are causing the issue
PhpOffice\PhpSpreadsheet\Calculation\TextData\Format::TEXTFORMAT uses DateTimeExcel\DateValue::fromString($value) to parse the text into a numeric value. In the case where only a time is provided DateValue::fromString returns (float)0.0
Possible fix is Format::TEXTFORMAT should check for the return of (float)0.0 and then hand off to DateTimeExcel\TimeValue::fromString($value) to get the correct numeric value
Reader
Writer
Styles
Data Validations
Formula Calculations
Charts
AutoFilter
Form Elements
Which versions of PhpSpreadsheet and PHP are affected?
Tested on PhpSpreadsheet 1.28 and PHP8.0
The text was updated successfully, but these errors were encountered:
oleibman
added a commit
to oleibman/PhpSpreadsheet
that referenced
this issue
Feb 28, 2023
This is:
What is the expected behavior?
Output of =TEXT("09:01","HH:MM:SS") is the time string 09:01:00
Verified with Excel and LibreOffice
What is the current behavior?
Output is 00:00:00
What features do you think are causing the issue
PhpOffice\PhpSpreadsheet\Calculation\TextData\Format::TEXTFORMAT uses DateTimeExcel\DateValue::fromString($value) to parse the text into a numeric value. In the case where only a time is provided DateValue::fromString returns (float)0.0
Possible fix is Format::TEXTFORMAT should check for the return of (float)0.0 and then hand off to DateTimeExcel\TimeValue::fromString($value) to get the correct numeric value
Which versions of PhpSpreadsheet and PHP are affected?
Tested on PhpSpreadsheet 1.28 and PHP8.0
The text was updated successfully, but these errors were encountered: