M
M
Michael2019-08-18 21:19:49
Yii
Michael, 2019-08-18 21:19:49

What causes the error: "Invalid value format" and how to fix it?

Hello everybody! When submitting the form, in the field with the date and time I get the error "Invalid value format".
Date field in the submit form:

<?= $form->field($model, 'date_filing')->widget(DateTimePicker::className(),[
    'name' => 'dp_2',
    'type' => DateTimePicker::TYPE_COMPONENT_PREPEND,
    'pluginOptions' => [
        'format' => 'd M yyyy H:i',
        'autoclose'=>true,
    ]
]); ?>

In the validation rules I have:
[['date_filing'], 'datetime', 'format' => 'php:d m Y H:i'],

Can the error occur due to the difference between the date / time formats in the widget and the validation rules?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question