2amigos / yii2-date-picker-widget

Bootstrap DatePicker Widget for Yii2
https://2amigos.us
Other
130 stars 77 forks source link

Date 'format' is not respected on 'Update'. #44

Closed Real-Gecko closed 3 years ago

Real-Gecko commented 7 years ago

I use widget in my _form.php that is used both by create and update actions:

        <?= $form->field($model, 'publication_date')->widget(
            DatePicker::className(), [
                'language' => 'ru',
                'clientOptions' => [
                    'autoclose' => true,
                    'format' => 'dd.mm.yyyy',
                    'todayBtn' => true,
                    'pickerPosition' => 'top-left'
                ]
        ]);?>

When I select desired date in create view, everything is fine: screenshot_20170420_175852

But when I go to 'update' view I see that required field is rendered like this: screenshot_20170420_175241 So, no format is respected during rendering the field. Any ways to fix?

tonydspaniard commented 7 years ago

@Real-Gecko have you tried providing the same format on server and client? Otherwise, I highly recommend that you modify the value of the attribute prior placing it on the widget. Maybe on