kartik日期控件没有设置日期。如果选择了星期二和星期四的日期;如果我检查隐藏输入字段的值,则在选定这两天之一时,它们被设置为false。拜托!我需要你的帮助我被困住了。这个版本是一个月前我下载的开发母版。

下面是我如何配置扩展:'datecontrol‘=> [ 'class’=> 'kartik\datecontrol\Module',
// format settings for displaying each date attribute (ICU format example)
'displaySettings' => [
Module::FORMAT_DATE => 'php:D d-M-Y',
Module::FORMAT_TIME => 'php:H:i:s',
Module::FORMAT_DATETIME => 'php:D d-M-Y H:i:s',
],
// format settings for saving each date attribute (PHP format example)
'saveSettings' => [
Module::FORMAT_DATE => 'php:Y-m-d',
Module::FORMAT_TIME => 'php:H:i:s',
Module::FORMAT_DATETIME => 'php:Y-m-d H:i:s',
],
// set your display timezone
// 'displayTimezone' => 'Asia/Kolkata',
// set your timezone for date saved to db
// 'saveTimezone' => 'UTC',
// automatically use kartik\widgets for each of the above formats
'autoWidget' => true,
// default settings for each widget from kartik\widgets used when autoWidget is true
'autoWidgetSettings' => [
Module::FORMAT_DATE => ['type'=>2, 'pluginOptions'=>['autoclose'=>true]], // example
Module::FORMAT_DATETIME => [], // setup if needed
Module::FORMAT_TIME => [], // setup if needed
],
// custom widget settings that will be used to render the date input instead of kartik\widgets,
// this will be used when autoWidget is set to false at module or widget level.
'widgetSettings' => [
Module::FORMAT_DATE => [
'class' => 'yii\jui\DatePicker', // example
'options' => [
'dateFormat' => 'php:d-M-Y',
'options' => ['class'=>'form-control'],
]
]
]
// other settings
]以下是我的看法:
<?=$form->field($model, 'dated')->widget(DateControl::classname(), [
'type'=>DateControl::FORMAT_DATE,
'language'=>Yii::$app->language,
'ajaxConversion'=>false,
'options' => [
'pluginOptions' => [
'autoclose' => true
]
]
])?>发布于 2016-02-29 16:09:33
我所做的是
我在web.php配置fie中启用时区设置
'displayTimezone' => 'UTC',
'saveTimezone' => 'UTC', 并设定
'ajaxConversion'=>true,因此,由于Mysql不将日期和时间数据类型数据转换为客户端时区;在显示时区时,日期不会受到该时区的影响。
https://stackoverflow.com/questions/35424476
复制相似问题