8000 [Form] Do not fail reverse transforming relative dates · Issue #28703 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Form] Do not fail reverse transforming relative dates #28703
Closed
@trompette

Description

@trompette

Description

Since v2.8.46, relative dates are not supported anymore by DateTimeType.

I am guessing this is because of the patches :

It would be great to introduce the feature again by adding a dedicated value of the format option, or anything better you can think of.

Example

At @lrqdo, the relative dates are helping us simplify our Behat scenarios.

Here is an example of a Behat scenario failing on v2.8.46:

When I send a POST request to "/endpoint" with values:
  | distributionDate | +14 days |
Then the response code should be 200
  Failed asserting that 400 is identical to 200.

Here is the form type we wrote:

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder->add(
        'distributionDate',
        DateTimeType::class,
        array(
            'widget' => 'single_text',
        )
    );
}

And here is the detailed error we get:

image

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