Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Form] DateType fails parsing when midnight is not a valid time #19531

Copy link
Copy link
Closed
@Jean85

Description

@Jean85
Issue body actions

In some timezones, midnight may not be a valid date; this happens when the DST change was done on midnight. It's a poor choice, and it was done only in the past. If you enter those dates in a DateType, it gets rejected as invalid.

Under the hood, the issue is with the \IntlDateFormatter that is initialized with the current timezone, when with a simple date it can be avoided... Here: https://github.com/symfony/symfony/blob/3.1/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php#L119

Maybe decoupling between DateType and DateTimeType could be a solution?

In my case, TZ is Europe/Rome and one of the infamous date is 1978-05-28; I can reproduce the issue in this 3val: https://3v4l.org/NDnbm
DateTime doesn't suffer this bug: https://3v4l.org/ZmQ1q

Mainly, the Form uses the intl extension, that uses ICU, and that assumes midnight as the hour if not specified, which is what happens when you use a DateType field.

I tried to open a bug on https://bugs.php.net/bug.php?id=72649 but it got closed... What can we do about it?

PS: this issue surfaced already multiple times: #18267 #16518 #16368

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.