扩展是
kartik\datetime\DateTimePicker;
关键是加入此配置 'minView'=> "month",示例如下:
<?php
echo DateTimePicker::widget([
'name' => 'dayEnd',
'value' => $request['dayEnd'] ? $request['dayEnd'] : "",
'options' => ['placeholder' => '截止日期','autocomplete'=>'off'],
'pluginOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd',
'todatHightlight'=>true,
//关键配置
'minView'=> "month",
],
]);
?>