yii2 - Yii Kartik DateControl Time Formatter Only Displays 12:30 On Update -
i using yii kartik datecontrol widget allow time selection displayed in 1 php format saved in another. primary issue having when save save time selection , go (to edit model) display 12:30pm.
for instance, select "6:30pm" time picker. correctly saves in database "18:30:00". on update display should read: "6:30pm", instead shows "12:30pm". whatever saved time is, switches "12:30pm" on update. , know switches because widget time button highlighted in green.
the following module setup:
'modules' => [ 'datecontrol' => [ 'class' => 'kartik\datecontrol\module', 'displaysettings' => [ module::format_date => 'mm/dd/yyyy', module::format_time => 'hh:mm a', module::format_datetime => 'mm/dd/yyyy hh:mm a', ], 'savesettings' => [ module::format_date => 'php:y-m-d', // saves unix timestamp module::format_time => 'php:h:i:s', module::format_datetime => 'php:y-m-d h:i:s', ], 'displaytimezone' => 'america/new_york', 'savetimezone' => 'america/new_york', 'autowidget' => true, 'ajaxconversion' => true, 'autowidgetsettings' => [ module::format_date => ['type'=>2, 'pluginoptions'=>['autoclose'=>true]], // example module::format_datetime => [], // setup if needed module::format_time => [], // setup if needed ],
this setup in view:
<?= $form->field($event, 'start_time')->label(false)->widget(datecontrol::classname(), [ 'type' => datecontrol::format_time, ]); ?>
i either did wrong here or there bug in widget haven't figured out. things i've tried:
- changing savetimezone 'utc'
- setting timezones in widget @ view level
- setting ajaxconversion false
- setting autowidget false
none of these me desired effect expected.
Comments
Post a Comment