Wednesday, 15 April 2015

forms - Increase date range Symfony2 -



forms - Increase date range Symfony2 -

hi have simple problem can't find solution :

i have

->add('dateofbirth', 'date', array ( 'widget' => 'choice', 'format' => 'dd-mm-yyyy', 'pattern' => '{{ day }}-{{ month }}-{{ year }', 'years' => range(1850 , date('y')) ))

with years go 1902 now. seems there predefined date range. code works because year >1902 takes account. possible alter this?

i found datetypetest class in /vendors code :

public function testyearsfor32bitsmachines() { if (4 !== php_int_size) { $this->marktestskipped( 'php must compiled in 32 bit mode run test'); } $form = $this->factory->create('date', null, array( 'years' => range(1900, 2040), )); $view = $form->createview(); $listchoices = array(); foreach (range(1902, 2037) $y) { $listchoices[] = new choiceview($y, $y, $y); } $this->assertequals($listchoices, $view['year']->vars['choices']); }

and tried alter 1902 date, if touching vendors isnt idea. didn't alter anything. maybe because i'm in prod ? occurence of 1902 can find in symfony folder

thx help

forms date symfony2 date-range

No comments:

Post a Comment