Browse Source

修复datetimepicker

wechat_public_accounts
blobt 5 years ago
parent
commit
3d85ebf84f
  1. 2
      kcadmin/views/category/_form.php
  2. 2
      vendor/blobt/widgets/DatetimePicker.php

2
kcadmin/views/category/_form.php

@ -28,7 +28,7 @@ use blobt\widgets\DatetimePicker;
<?= $form->field($model, 'sort_order')->textInput() ?> <?= $form->field($model, 'sort_order')->textInput() ?>
<?= $form->field($model, 'created_at')->widget(DatePicker::className()) ?>
<?= $form->field($model, 'created_at')->widget(DatetimePicker::className()) ?>
</div> </div>
<div class="box-footer"> <div class="box-footer">

2
vendor/blobt/widgets/DatetimePicker.php

@ -67,6 +67,7 @@ class DatetimePicker extends InputWidget {
*/ */
public function run() { public function run() {
$this->initSetting(); $this->initSetting();
echo $this->renderHiddenInput();
echo $this->renderDatetimePickerInput(); echo $this->renderDatetimePickerInput();
$this->registerAsset(); $this->registerAsset();
} }
@ -132,6 +133,7 @@ SCRIPT;
if ($this->hasModel()) { if ($this->hasModel()) {
$timestamp = ArrayHelper::getValue($this->model, $this->attribute); $timestamp = ArrayHelper::getValue($this->model, $this->attribute);
$value = date($this->format, $timestamp);
} }
if (empty($timestamp) && $this->autoFill) { if (empty($timestamp) && $this->autoFill) {

Loading…
Cancel
Save