Symfony2 Date Field Year

2019-07-05 05:27发布

I am developing an application using Symfony2. The problem comes when creating a registration form that require to use a date field to indicate the date in which the user was born, the possible values for the year are in range 2007-2017. How can I modify this values the years to be for example,in the range 1920-actual year? Thanks.

1条回答
一纸荒年 Trace。
2楼-- · 2019-07-05 05:54

Look up in the documentation next time:

$builder->add('birthday', 'date', array(
    'years' => range(1920, date('Y'))
));
查看更多
登录 后发表回答