Skip to content

Navigation Menu

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] reject DateType values before begin of gregorian calendar? #29610

Copy link
Copy link
Open
@apfelbox

Description

@apfelbox
Issue body actions

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:

  1. reject dates outside of the range of the calendar as invalid
  2. change internal implementation to allow usage of these old dates
  3. ???

vid

Additional context

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.