It happens that I have used the minDate option to deactivate the days before the current one to avoid selecting a date already in the past. This works perfectly for me in the create but in the update it does not show me the time, only the empty widget appears, although in the database it shows that the date was registered. I would like to know what error may be happening.
Rules
[['inicio_clase', 'fin_clase'], 'default', 'value' => function () {
return date(DATE_ISO8601);
}],
[['inicio_clase', 'fin_clase'], 'filter', 'filter' => 'strtotime', 'skipOnEmpty' => true],
[['inicio_clase', 'fin_clase','seccion_id', 'materia_id', 'estado'], 'integer'],
['inicio_clase','compare','compareAttribute'=>'fin_clase','operator'=>'<','message'=>'La fecha de inicio debe ser menor que la fecha de finalización.'],
['fin_clase','compare','compareAttribute'=>'inicio_clase','operator'=>'>','message'=>'La fecha de fin no debe ser menor o igual que la fecha de inicio.'],
Form
<?php echo $form->field($model, 'fin_clase'(
DateTimeWidget::class,
[
'phpDatetimeFormat' => 'yyyy/MM/dd HH:mm',
'clientOptions' => [
'minDate' => new \yii\web\JsExpression('new Date()'),
]
]
) ?>