If I understand correctly (probably not, of course), following this guide:
http://www.yiiframew…widget-jui.html
it can be possible to configure DatePicker in few steps:
Formatter in web.cfg:
'formatter' => [
'dateFormat' => 'dd-MM-yyyy',
'decimalSeparator' => ',',
'thousandSeparator' => ' ',
'currencyCode' => 'EUR',
'locale' => 'it-IT',
'defaultTimeZone' => 'Europe/Rome',
DatePicker in ActiveForm:
<?= $form->field($model, 'data')->widget(\yii\jui\DatePicker::className(), [
// if you are using bootstrap, the following line will set the correct style of the input field
'options' => ['class' => 'form-control'],
// ... you can configure more DatePicker properties here
]) ?>
And the rules in module:
public function rules()
{
return [
//...
[['data'], 'safe'], //maybe is this redundant ?
['data', 'default', 'value' => null],
['data', 'date', 'timestampAttribute' => 'data'],
//...
];
}
In Mysql table the field "data" is setting as "date" (that is what I need, but I tried also with "timestamp"). In any case when I update or when I create new record the "data" field return 0000-00-00.
Where I do wrong, please?