Bug In Cjuidatepicker Options

In CjuiDatePicker, I cannot use the option = "beforeShowDay", because this option need function return.


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

			'model'=>$model,

			'attribute'=>'user_end_date',

			'options'   => array(

				'changeYear' => true,

				'dateFormat' => 'mm/dd/yy',

				//'timeFormat' => '',//'hh:mm tt' default

				//'beforeShowDay'=>'function(selectedDate){var disabledDates = ["04/30/2014", "05/01/2014"];for (var i = 0; i < disabledDates.length; i++) {if (new Date(disabledDates[i]).toString() == selectedDate.toString()){return false;}}return true;}',

				//'beforeShowDay'=>'editDays',

				'beforeShowDay'=>'function(a){a=a.getDay();return[a>0&&a<6,""]}',

			),

		));



But in CJuiDatePicker, it always return option value in a string value, which cannot call the function properly.

See

http://api.jqueryui.com/datepicker/#option-beforeShowDay

to see more details about datepicker api.

My suggestion is try to put "beforeShow" and "beforeShowDay" in a separate way to deal with.

Below line should be fixed in CJuiDatePicker.php




$options=CJavaScript::encode($this->options);



Hey Johnny, try put "js:" before it


'beforeShowDay'=>'js:function(a){a=a.getDay();return[a>0&&a<6,""]}',

Thank you, I tested that, and it works. That’s awesome!