2amigos/yii2-date-picker-widget yii\db\Exception error

I keep getting this errors when saving the form : Database Exception – yii\db\Exception

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: ‘29-4-2020’ for column ‘registered’ at row 1

kindly assist

my form.php

<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use dosamigos\datepicker\DatePicker;

/* @var $this yii\web\View */
/* @var $model backend\models\Supplier */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="supplier-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'type')->dropDownList([ '2' => 'Cash', '3' => 'Credit'], ['prompt' => 'Select']) ?>

    <?= $form->field($model, 'status')->dropDownList([ '1' => 'Active', '0' => 'Inactive'], ['prompt' => 'Select']) ?>

    <?= $form->field($model, 'registered')->widget(
                DatePicker::className(), [
                    // inline too, not bad
                     'inline' => false, 
                     // modify template for custom rendering
                    //'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>',
                    'clientOptions' => [
                        'autoclose' => true,
                        'format' => 'dd-m-yyyy'
                    ]
            ]);?>

    

    <?= $form->field($model, 'created_at')->hiddenInput(['value' => date('d-m-Y')])->label(false) ?>

    <div class="form-group">
        <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>

my model

?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "supplier".
 *
 * @property int $id
 * @property string $name
 * @property string $phone
 * @property string $email
 * @property int $type
 * @property int $status
 * @property string $registered
 * @property string $created_by
 * @property string $created_at
 */
class Supplier extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'supplier';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['name', 'phone', 'email', 'type', 'status', 'registered', 'created_by', 'created_at'], 'required'],
            [['type', 'status'], 'integer'],
            [['registered', 'created_at'], 'safe'],
            [['name', 'email'], 'string', 'max' => 100],
            [['phone'], 'string', 'max' => 13],
            [['created_by'], 'string', 'max' => 50],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'phone' => 'Phone',
            'email' => 'Email',
            'type' => 'Type',
            'status' => 'Status',
            'registered' => 'Registered',
            'created_by' => 'Created By',
            'created_at' => 'Created At',
        ];
    }
}

Try

‘format’ => ‘dd-M-yyyy’

didnt work same error

show me the field from database

maybe this should be like 29-04-2020

try

YYYY-mm-dd It has worked I also changed the database type to varchar…

I believe you’re not using migrations… I recommend that for started.
Using Date field type is very helpful later to run query about period from X to Y…