Skip to content

Regression in 4.3.0: Date::stringToExcel requires precision #4488

Closed
@pcf0

Description

@pcf0

With the PR #4479, the regex for a valid date/time value was adjusted.
Now it seems to be necessary to specify miliseconds, as the added match group ([.]\d+) is not optional.

Example:

var_dump(\PhpOffice\PhpSpreadsheet\Shared\Date::stringToExcel('26.05.2025 14:28:00'));
var_dump(\PhpOffice\PhpSpreadsheet\Shared\Date::stringToExcel('26.05.2025 14:28:00.00'));

Output 4.2.0:

float(45803.60277777778)
bool(false)

Output 4.3.0:

bool(false)
float(45803.60277777778)

I would expect the following:

float(45803.60277777778)
float(45803.60277777778)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions