Cjuidatepicker - Pick Specific Day [Solved]

Hi guys!

I am using CJuiDatePicker to select a date, but i would like to be able to set up which day of the week you can choose. I mean, you see all the calendar but you could choose just Mondays (or any other desired day).

Is there any option to configure this extension to do that? If not, how could i do it?

I really appreciate any suggestion :rolleyes:

Thanks!

SOLUTION:




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

    'name'=>'justmonday',

	'options'=>array(

	        'showAnim'=>'fold', 

	        'showOn'=>'both',

	     	'beforeShowDay'=> 'js:function(date){ 

					  var day = date.getDay(); 

					  return [day == 1,""];

					}',

		),

								    'htmlOptions'=>array(

	        'style'=>'width:80px;vertical-align:top'

		),

));



If you want to show more than 1 day, just add || day="NUMBER"

This will show Mondays and Fridays:




return [day == 1 || day == 5,""];



::)

Hello, perhaps you could try using options : ‘beforeShowDay’ as mentioned here

Thank you C.S.Putera!!

SOLVED with ‘beforeShowDay’.

This example will show just Mondays:




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

    'name'=>'justmonday',

	'options'=>array(

	        'showAnim'=>'fold', 

	        'showOn'=>'both',

	     	'beforeShowDay'=> 'js:function(date){ 

					  var day = date.getDay(); 

					  return [day == 1,""];

					}',

		),

								    'htmlOptions'=>array(

	        'style'=>'width:80px;vertical-align:top'

		),

));



If you want to show more than 1 day, just add || day="NUMBER"

This will show Mondays and Fridays:




return [day == 1 || day == 5,""];



::)

You are welcome :D