Open
Description
Symfony version(s) affected: 4.2.1
Description
I am currently running into an issue where I want to format really old dates using the IntlDateFormatter
with the gregorian calendar, but the formatted date is wrong by several days.
How to reproduce
See this stack overflow question: https://stackoverflow.com/questions/53780818/why-is-my-intldateformatter-formatting-the-wrong-day
and this 3v4l: https://3v4l.org/tXVgn
Possible Solution
This is an issue with PHP / Intl or at least it's undefined behavior as the calendar didn't exist in this year yet.
How does this affect symfony? Symfony is using the IntlDateFormatter
in the DateType
and therefore you have the following scenario:
- Submit form with date
- Date is correctly parsed
- Date is re-rendered with offset
- Submit form
- -> now the day always shifts by e.g. 1 day
Possible solutions:
- reject dates outside of the range of the calendar as invalid
- change internal implementation to allow usage of these old dates
- ???
Additional context