bootstrap-Date Time Picker 詳細配置請參考http://www.bootcss.com/p/bootstrap-datetimepicker/
use kartik\widgets\DatePicker;//使用這個組件(需安裝),bootstrap的datepicker一樣配置(yii2自帶)。
$years = $form->field($model, 'years')->widget(DatePicker::classname(), [
'options' => ['value' => $currentYear],
'removeButton' => false,
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy',//yyyy選擇到年,yyyy-mm到月,yyyy-mm-dd到天
'startView'=>2, //其實范圍(0:日 1:天 2:年)
'maxViewMode'=>2, //最大選擇范圍(年)
'minViewMode'=>2, //最小選擇范圍(年)
'todayHighlight' => true, // 今日高亮
'autoclose' => true, // 選擇后自動關閉
'todayBtn' => true, // 今日按鈕顯示
]
]);