D
D
Dmitry2018-02-18 21:53:50
Yii
Dmitry, 2018-02-18 21:53:50

Widget from kartik and Cyrillic?

Good evening.
In the form I use a widget from kartik DateControll.

<?= $form->field($model, 'date')->widget(DateControl::className(),
                ['type' => DateControl::FORMAT_DATE, 'displayTimezone' => 'Europe/Kiev']
                                                            )
            ?>

The date format is "February 8, 2018".
At first everything worked as it should. But after updating yii2 to version 2.0.13.1, the widget stopped working with the Russian language.
There are no errors in runtime/logs, nor in server logs. When choosing a date, the response from the server is "200", but the date is not converted to a timestamp.
h_1518978698_9178153_b033ca3835.png
As you can see in the picture, the "output" parameter is not filled. If the date is in English ("8 February 2018") - everything works, "output" gets a timestamp. It is natural that validation swears.
With what it is connected I can not understand in any way.
Widget settings
'datecontrol' =>  [
    'class' => '\kartik\datecontrol\Module',
    'displaySettings' => [
        Module::FORMAT_DATE => 'd MMMM yyyy',
        Module::FORMAT_TIME => 'HH:mm',
        Module::FORMAT_DATETIME => 'd MMMM yyyy HH:mm'
    ],
    'displayTimezone' => 'Europe/Kiev',
    'autoWidgetSettings' => [
        Module::FORMAT_DATETIME => ['pluginOptions' => [
            'autoclose' => true,
            'todayHighlight' => true,
            'startDate' => date('d m Y'),
        ],
            'readonly' => true],
        Module::FORMAT_DATE => ['pluginOptions' => [
            'autoclose' => true,
            'todayHighlight' => true,
        ],
            'readonly' => true],
        Module::FORMAT_TIME => ['readonly' => true]
    ],
    'saveSettings' => [
        Module::FORMAT_DATETIME => 'php:U',
        Module::FORMAT_DATE => 'php:U',
        Module::FORMAT_TIME => 'php:U',
    ],
    'ajaxConversion' => true,
]

Setting Formatter
'formatter' => [
   'class' => 'yii\i18n\Formatter',
   'dateFormat' => 'dd MMMM yyyy',
   'defaultTimeZone' => 'Europe/Kiev',
   'datetimeFormat' => 'php: j F H:i:s',
   'locale' => 'ru'
]

Is it possible that this is related to this update?
If not, how to solve the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-02-20
@slo_nik

The problem seems to have been resolved. The point was not in the formatter settings, but in the kartik widget itself.
On his demo page and on github , the command to install the widget is . The version "dev-master" was installed And, as I understand it, after updating to 2.0.13.1 and higher, the widget refused to work with the Russian language (and not only). Solved the problem by deleting the datecontrol and reinstalling the widget. Now the version is "^1.9" and while it works, a timestamp comes in the response from the server.
h_1519081714_6192203_5699e28a1c.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question