Please help me with CJuiDatePicker

Hi all. im new to yii. Im implementing CJuiDatePicker for the registration page and i’ve been trying to figure out how to set the range of the year that the user can choose from the dropdown in CJuiDatePicker. I’ve been trying to find the answer throughout the forum but no result yet.

when i use ‘yearRange’=>1982 the CJuiDatePickerwon’t work.

Please help. Thanks

Hi ,

try this out in your widget option, working fine with mine.


	'showAnim'=>'fold',         // appear style

	'dateFormat'=>'dd-mm-yy',   // date format



	'yearRange'=>'1982',        // answer of your question



You need to use yearRange in the options array

$this->widget('zii.widgets.jui.CJuiDatePicker', array(




    // additional javascript options for the date picker plugin









            'yearRange'=> '1910:2020',



Hi. Im sorry for my late reply. Yes, i already put the yearRange inside the option.

Now the code looks like this :






            'hourGrid' =&gt; 4,

            'hourMin' =&gt; 0,

            'hourMax' =&gt; 23,


            'showHour' =&gt; false,

            'showMinute' =&gt; false,

            'showTime' =&gt; false,


            'changeMonth' =&gt; true,

            'changeYear' =&gt; true,

            'yearRange'=&gt; '1910:2020',




Instead of using ‘yearRange’ => ‘1910’ (which doesnt work for me) I use ‘yearRange’=> ‘1910:2020’ and it works. Thanks for the solution =)