jQuery日期范围选择器插件使用总结。
版本说明:
当前使用版本:2.1.25
特别说明:版本不同,部分美国石油学会(美国石油协会)可能会发生变化,需要引起重点关注
效果图
关键代码片段
$('#dateTimeRange span ').html(矩()。减去(1,'小时')。格式(' YYYY-MM-DD HH:mm') '~ '矩()。格式(' YYYY-MM-DD hh :MM ');$('#dateTimeRange ').daterangepicker({ maxDate : moment(),//最大时间dateLimit : { days : 30 },//起止时间的最大间隔showDropdowns :为真,showWeekNumbers :为假,//是否显示第几周timePicker : true,//是否显示小时和分钟timePickerIncrement : 60,//时间的增量,单位为分钟timePicker12Hour : false,//是否使用12小时制来显示时间范围: { '最近一小时:[矩()。减法(1,'小时')、矩()]、'今日:[矩()。开始时间('天'),时刻()],'昨日:[矩()。减去(1,'天')。开始时间('天'),时刻()。减去(1,'天')。endOf('day')],'最近七日:[矩()。减法(6,'天'),矩()],'最近30日:[矩()。减法(29,' days '),moment()] },打开: '右',//日期选择框的弹出位置buttonClasses :[' BTN BTN-默认'],applyClass : ' BTN-小BTN-主蓝色',cancelclasses : ' BTN-小',区域设置: { applyLabel : '确定,cancelLabel : '取消,fromLabel : '起始时间,toLabel : '结束时间,customRangeLabel : '自定义,daysOfWeek : ['日', '一', '二', '三', '四', '五', '六],monthNames : ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月],firstDay : 1 } },函数(开始、结束、标签){ //格式化日期显示框$('#dateTimeRange span ').html(开始。减法(1,'小时').格式(' YYYY-MM-DD hh :MM ')' ~ '结束。格式(' YYYY-MM-DD hh :MM ');});html:
div class='inline '标签时间段:/label div class=' date-picker form-inline-control ' id=' datetime range ' I class=' glyphicon glyphicon-calendar fa-calendar '/I span id=' searchdaertrange '/span b class='脱字符号/div /div以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。