起止时间设置
HTML:
1 <link rel="stylesheet" href="cssLib/bootstrap-datepicker.css"> 2 <script type="text/javascript" src="jsLib/bootstrap-datepicker.js"></script> 3 <script type="text/javascript" src="jsLib/bootstrap-datepicker.zh-CN.js"></script> 4 5 6 <div class="input-group date" data-provide="datepicker"> 7 <input type="text" class="form-control"> 8 <div class="input-group-addon"> 9 <span class="glyphicon glyphicon-th"></span> 10 </div> 11 </div> 12 <div class="input-daterange input-group" id="datepicker"> 13 <input type="text" class="form-control" name="start" id="qBeginTime" ng-model="startTime" readonly/> 14 <span class="input-group-addon">至</span> 15 <input type="text" class="form-control" name="end" id="qEndTime" ng-model="endTime" readonly/> 16 </div>
JS:
1 $('#qBeginTime').datepicker({ 2 format: 'yyyy-mm-dd hh:ii:ss', 3 //todayBtn : true, 4 clearBtn: true, 5 autoclose : true, 6 todayHighlight : true, 7 language: 'zh-CN', 8 maxViewMode: 4, 9 endDate : new Date() 10 }).on('changeDate',function(e){ 11 var startTime = e.date; 12 $('#qEndTime').datepicker('setStartDate',startTime); 13 }); 14 //结束时间: 15 $('#qEndTime').datepicker({ 16 format: 'yyyy-mm-dd hh:ii:ss', 17 //todayBtn : "linked", 18 clearBtn: true, 19 autoclose : true, 20 todayHighlight : true, 21 language: 'zh-CN', 22 endDate : new Date() 23 }).on('changeDate',function(e){ 24 var endTime = e.date; 25 $('#qBeginTime').datepicker('setEndDate',endTime); 26 });