基于daterangepicker日历插件使用参数注意的问题

基于daterangepicker日历插件使用参数注意的问题

显示具体时间时分秒:

timePicker设置为true,//有些资料写的pickerTime不太对

重点大坑:修改时间默认展示格式,把fomat写在locale中,网上很多资料说直接写在daterangepicker属性中,这样是不生效的。

起止时间可以设置为具体年月日也可以生成当前日期(new Date()  或者 moment()【moment()方法为moment.js获取当前时间的函数】)

$(“#dateid”).daterangepicker({      startDate: moment(),// '2013-01-01',      maxDate:new Date(),      endDate: moment(),//new Date(),      dateLimit : {        days : 30      }, //起止时间的最大间隔      timePicker : true, //是否显示小时和分钟      timePickerIncrement : 1, //时间的增量,单位为分钟      timePicker24Hour : true, //是否使用24小时制来显示时间      locale: {//用来设置默认时间显示格式,各个按钮空间的中文显示format: 'YYYY/MM/DD HH:mm:ss',applyLabel: '确认',       cancelLabel: '取消',       fromLabel: '从',       toLabel: '到',       weekLabel: 'W',       customRangeLabel: '选择时间',       daysOfWeek:["日","一","二","三","四","五","六"],       monthNames: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十 一月","十二月"],}    range: {//设置快捷区间控件,不同的时间段      "近期": ['2015-04-12',new Date()]    }  }, function (start, end, label) {    alert('A date range was chosen: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));  }

以上这篇基于daterangepicker日历插件使用参数注意的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

tag:参数插件使用日历电脑软件daterangepicker

相关内容