Hi, first post here,
I hope you guys can help me a little. I’m working on my first yii2 application and I just installed krajees datecontrol (im not allowed to link it right now)
And it’s working. As a visitor, I can choose a date and it gets stored in the database (in unixtime).
Code:
$form->field($model, 'myDateField')->widget(DateControl::classname(), [
'type'=>DateControl::FORMAT_DATE,
'ajaxConversion'=>true,
'saveFormat' => 'php:U',
'displayFormat' => 'php:d.m.Y',
'saveTimezone' => 'Europe/Amsterdam',
'displayTimezone' => 'Europe/Amsterdam',
'language' => 'de',
'widgetOptions' => [
'pluginOptions' => [
'autoclose' => true
]
]
]);
After saving my object, I can validate the saved date:
select id, myDate,from_unixtime(myDate) from myTable order by id desc;
So I am sure that the correct date is saved. But, If I edit my object, there is a wrong date displayed, it’s always savedDate-1day.
my yii2-Settings should be correct too
'defaultTimeZone' => 'Europe/Amsterdam',
It would be great if someone could help me here,
ty!