Closed
Description
Description
Since v2.8.46, relative dates are not supported anymore by DateTimeType
.
I am guessing this is because of the patches :
- bug [Form] fail reverse transforming invalid RFC 3339 dates #28466 [Form] fail reverse transforming invalid RFC 3339 dates
- bug [Form] Fix DateTimeType html5 input format #28372 [Form] Fix DateTimeType html5 input format
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: