DateRangePicker 中文化以及老版本的一些初始化问题,不能选择秒的问题

$('#headlineAddForm #rangeTime').daterangepicker({  
showDropdowns : true,
timePicker : true, //是否显示小时和分钟
timePicker24Hour: true,
timePickerIncrement : 1, //时间的增量,单位为分钟
timePickerSeconds : true,
linkedCalendars : false,
locale : {
format: "YYYY-MM-DD HH:mm:ss", //控件中from和to 显示的日期格式
separator : " - ",
applyLabel : "确定",
cancelLabel : "取消",
fromLabel : "开始",
toLabel: "结束",
customRangeLabel : "自定义",
weekLabel : "W",
daysOfWeek : ["日", "一", "二", "三", "四", "五", "六"],
monthNames : ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月 "],
firstDay : 1
}
}, function(start, end, label) {
$("#headlineAddForm #startTime").val(start.unix());
$("#headlineAddForm #endTime").val(end.unix());
}).on('hide.daterangepicker', function() {
$('#headlineAddForm').data('bootstrapValidator').updateStatus('rangeTime', 'NOT_VALIDATED',null).validateField('rangeTime');
}).on('cancel.daterangepicker', function() {
$('#headlineAddForm #rangeTime').val("");
$('#headlineAddForm').data('bootstrapValidator').updateStatus('rangeTime', 'NOT_VALIDATED',null).validateField('rangeTime');
}).on('apply.daterangepicker', function() {
if($.trim($("#headlineAddForm #startTime").val()).length == 0) {
$('#headlineAddForm #rangeTime').val("");
$('#headlineAddForm').data('bootstrapValidator').updateStatus('rangeTime', 'NOT_VALIDATED',null).validateField('rangeTime');
}
});
$('#headlineModifyForm #rangeTime').daterangepicker({  
showDropdowns : true,
timePicker : true, //是否显示小时和分钟
timePicker24Hour: true,
timePickerIncrement : 1, //时间的增量,单位为分钟
timePickerSeconds : true,
linkedCalendars : false,
locale : {
format: "YYYY-MM-DD HH:mm:ss", //控件中from和to 显示的日期格式
separator : " - ",
applyLabel : "确定",
cancelLabel : "取消",
fromLabel : "开始",
toLabel: "结束",
customRangeLabel : "自定义",
weekLabel : "W",
daysOfWeek : ["日", "一", "二", "三", "四", "五", "六"],
monthNames : ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月 "],
firstDay : 1
}
}, function(start, end, label) {
$("#headlineModifyForm #startTime").val(start.unix());
$("#headlineModifyForm #endTime").val(end.unix());
}).on('hide.daterangepicker', function() {
$('#headlineModifyForm').data('bootstrapValidator').updateStatus('rangeTime', 'NOT_VALIDATED',null).validateField('rangeTime');
});
  • 本文作者:Jack Yao
  • 本文链接: js_date_range_picker
  • 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!