8000 DateType form field single_text transformer issue · Issue #18267 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
DateType form field single_text transformer issue #18267
Closed
@yellowmamba

Description

@yellowmamba

Hi guys,

When I use "single_text" to render a doctrine date field as an HTML5 input field, I get errors when the date is set to "1985-04-01", however, if the value is "1985-04-02" or "1985-04-03", it works. This problem only occurs on our production server, it's not any issue in our local development environment.

Code:

$builder
    ...
    ->add('date_of_birth', 'date', ['widget' => 'single_text', 'format' => 'yyyy-MM-dd'])

I'm able to track down the issue that the error on production server is the result of TransformationFailedException. When Symfony transforms string to a datetime object, it gets an IntlDateFormatter object to parse the string value, should an error occur, it would be recorded and thrown through above Exception class. Symfony instantiates the php built-in IntlDateFormatter class which is from the INTL extension I believe, I compared the extension on our production server and development server, the version are the same, both 1.1.0, all directives are the same, only difference being ICU version, which on production is 52.1 while in development environment is 4.6.

The error I am getting on production for specific dates is U_PARSE_ERROR, which indicates something is wrong in the parse method I mentioned above.

I do find Symfony provides an alternative formatter, Symfony\Component\Intl\DateFormatter\IntlDateFormatter, but I don't know where it's been used. Is this class intended to tackle issues like I reported?

Any help would be appreciated!

Cheers

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

      0