yii\jui\DatePicker

Hola les hago una consulta como puedo desabilitar los dias que hay en un array mas los fines de semana si me dan una mano se los agradesco. saludos dejo el codigo

$feriados="['17/03/2019', '18/03/2019', '25/03/2019', '04/03/2019']";

echo DatePicker::widget([
          'name' => 'Fecha',
            'id' => 'Fecha',
            'language' => 'es',
            'dateFormat' => 'dd-MM-yyyy',
            'clientOptions' => [ 
                             'changeMonth' => true, 
                             'changeYear' => true, 
                             'showButtonPanel' => true, 
                             'yearRange' => '2019:2019' ,

                            ],
            
            'options'=> ['class'=>'', 'autocomplete'=>'off',]
        ]); ?>

Hi @jmr22, welcome to the forum.

I have moved this post from “Yii 2.0” to “International > Spanish”.
Please write in English in general forums.

I’m sorry and thanks

1 Like

Hola @jmr22,

You probably will want to add beforeShowDay, see JS example here:
https://www.codeproject.com/Questions/876970/how-to-disable-specific-days-in-JQuery-datepicker

echo DatePicker::widget([
          'name' => 'Fecha',
            'id' => 'Fecha',
            'language' => 'es',
            'dateFormat' => 'dd-MM-yyyy',
            'clientOptions' => [ 
                             'changeMonth' => true, 
                             'changeYear' => true, 
                             'showButtonPanel' => true, 
                             'yearRange' => '2019:2019' ,
                             'beforeShowDay' => yii\web\JsExpression(<<<JS
function(d) {
  console.log("showing: ", d);
  // do your test & return true if this day should be enabled, false otherwise
}
JS
)
                            ],
            
            'options'=> ['class'=>'', 'autocomplete'=>'off',]
        ]); ?>
1 Like

hola @machour genial muchas gracias

1 Like