Open
Description
Description
BirthdayType is just a decoration of DateType with a convenient choice of years.
Unfortunately, if you use the "single_text" widget option, it becomes useless because there is no longer a choice of years.
In this case, it would be nice if, instead of passing the "years" option to DateType, it would pass the "attr" option, with min/max instead.
Example
this code
<?php
// use...
class MyFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('foo', BirthdayType::class, ['widget' => 'single_text'],
}
}
should behave like if I wrote
<?php
// use...
class MyFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('foo', BirthdayType::class, [
'widget' => 'single_text',
'attr' => ['min' => date('Y-m-d', strtotime('120 years ago)), 'max' => date('Y-m-d')]
],
}
}