V
V
Vadim2018-08-06 14:01:14
Yii
Vadim, 2018-08-06 14:01:14

Problem with time zone in kartik\datecontrol\DateControl?

I use kartik\datecontrol\DateControl to save
the date by -3 hours and, accordingly, when I edit it, it shows yesterday. who faced?

echo $form->field($model, 'date_started')->widget(DateControl::classname(), [
        'type'=>DateControl::FORMAT_DATE,
        'value' => $selected_date_started,
//        'displayFormat' => 'php: d.m.Y',
//        'saveFormat' => 'php:U',
        'ajaxConversion'=>true,
//        'displayTimezone' => 'Etc/GMT+6',
//        'saveTimezone' => 'Etc/GMT+6',
        'widgetOptions' => [
            'layout' => '{input}{remove}{picker}',
            'pluginOptions' => [
                'autoclose' => true,
                'todayHighlight' => true,
                'todayBtn' => true,
            ],
        ]
    ])->label('Дата начала');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-08-06
@webinar

Check how realistic it is in the database, at what stage "-3 hours" occurs. I advise you to check the timezone in mysql, it's best to have +0 there. And already at the level of yii and the DateControl module itself, specify the necessary timezones in the config

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question