Description
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