Home  >  Article  >  Backend Development  >  The endDate of DateTimePicker in YII causes an error in the month limit

The endDate of DateTimePicker in YII causes an error in the month limit

WBOY
WBOYOriginal
2016-07-06 13:53:281253browse

1. Question

After YII’s DateTimePicker sets the maximum selectable date, the month before the maximum date and the current month cannot be selected. Is this a bug in DateTimePicker itself? How to solve it?
(If the maximum selection date is set to 2016-09-15, then September and August cannot be selected in the month view)

2. Code
<code><br><?php<br>echo DateTimePicker::widget([echo DateTimePicker::widget([

 'name' => 'checkTime',
 //注意,该方法更新的时候你需要指定value值
 'value' => '20'.date("y-m-d"),
 'pluginOptions' => [
    'autoclose' => true,//当选择一个日期后自动关闭日期选择器
    'format' => 'yyyy-mm-dd',//输入框显示的格式
    'todayHighlight' => true,//高亮今日
    'minView' => 'month',//日期选择器的最小视图为月视图
    'todayBtn' => 'linked',//显示today按钮
    'endDate' => '2016-09-15',//设置可选择的最大日期
    ],
  'options' => ['id' => 'checkTime', 'class' => 'text-center checkTime','readonly' => 'readonly', 'style' => 'width:100px;display:inline-block' ]]);


?>


3. ResultsThe endDate of DateTimePicker in YII causes an error in the month limit

Reply content:

1. Question


After YII’s DateTimePicker sets the maximum selectable date, the month before the maximum date and the current month cannot be selected. Is this a bug in DateTimePicker itself? How to solve it? (If the maximum selection date is set to 2016-09-15, then September and August cannot be selected in the month view)


2. Code<code><br><?php<br>echo DateTimePicker::widget([

'name' => 'checkTime', //注意,该方法更新的时候你需要指定value值 'value' => '20'.date("y-m-d"), 'pluginOptions' => [ 'autoclose' => true,//当选择一个日期后自动关闭日期选择器 'format' => 'yyyy-mm-dd',//输入框显示的格式 'todayHighlight' => true,//高亮今日 'minView' => 'month',//日期选择器的最小视图为月视图 'todayBtn' => 'linked',//显示today按钮 'endDate' => '2016-09-15',//设置可选择的最大日期 ], 'options' => ['id' => 'checkTime', 'class' => 'text-center checkTime','readonly' => 'readonly', 'style' => 'width:100px;display:inline-block' ]]);echo DateTimePicker::widget([


?>


The endDate of DateTimePicker in YII causes an error in the month limit3. Results

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn