-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] BirthdayType and dates before 1583 #31057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yep, seems to be the same issue. |
see #31374 for an attempt to fix this |
Closing as fixed by #31374. |
That PR wasn't merged. Thus let's reopen here. |
Hey, thanks for your report! |
Still broken I guess. |
Hey, thanks for your report! |
Just a quick reminder to make a comment on this. If I don't hear anything I'll close this. |
As @xabbuh already indicated with the label: I still think properly handling all dates in these types is important. |
Who wants to investigate this issue and maybe work on a fix? |
I have started to investigate this problem and so far it seems to work correctly that the date before 1582-10-15 is not a valid date according to the Gregorian calendar. If someone enters a date that is on or before 1582-10-14, then there the date entered is intended to be a Julian calendar string date (<1582-10-14 is an invalid date in Gregorian cal.). This date needs to be converted to a Gregorian date, since \DateTime handles well only the Gregorian calendar. When the time zone enters the picture php starts to do very strange things. Further research is needed to find out how this part of the PHP works. |
If I don't allow pre-Gregorian dates to be formatted by if ($timestamp >= -12219292800) {
$value = $this->getIntlDateFormatter()->format($timestamp);
} else {
$value = $dateTime->format('Y-m-d');
} |
Symfony version(s) affected: 4.2.x
Description
We encountered an issue with the BirthdayType and dates before the Gregorian calendar changes took place. I don't know the reason, but it maybe just an issue with php-intl. When using January, 1st 1582 as a birthday the view format (using German format in the screenshot) goes nuts:
PHP got it correctly but the view format gets off the 11 added days: https://en.wikipedia.org/wiki/Gregorian_calendar#Gregorian_reform
How to reproduce
Create a form with a
BirthdayType
and setnew \DateTime('1582-01-01)
as the data.Possible Solution
No clue. As this seems to be handled by the IntlFormatter that is broken or unable to handle this? I' just confused.
The text was updated successfully, but these errors were encountered: