$('#date-picker').daterangepicker({
format: 'YYYY-MM-DD',
// timePicker: true
singleDatePicker: true ,
}, function(start, end, label) {
console.log(start.toISOString(), end.toISOString(), label);
});
$('#date-picker').daterangepicker({
"autoApply": true,
"singleDatePicker": true,
"showDropdowns": true,
"timePicker": true,
"timePicker24Hour": true,
"startDate": moment().hours(0).minutes(0).seconds(0), //设置开始日期
"opens": "center",
"drops": "up",
locale: {
format: "YYYY-MM-DD HH:mm:ss",
applyLabel: '确定',
cancelLabel: '取消',
daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
'七月', '八月', '九月', '十月', '十一月', '十二月'
],
firstDay: 1
},
}, function(start) {
console.log(start.format('YYYY-MM-DD HH:mm:ss'));
});
$('#date-picker').daterangepicker({
timePicker: true, //显示时间
timePicker24Hour: true, //时间制
timePickerSeconds: true, //时间显示到秒
format: 'YYYY-MM-DD HH:mm:ss',
startDate: new Date(),
endDate: new Date(),
minDate:1999-12-12,
maxDate:2050-12-30,
timePicker: true,
timePickerIncrement: 1,
locale:{
applyLabel: "确认",
cancelLabel: "取消",
resetLabel: "重置",
}
}, function (start, end, label) {
console.log('选择日期范围: ' + start.format('YYYY-MM-DD HH:mm:ss') + ' 到 ' + end.format('YYYY-MM-DD HH:mm:ss'));
});