bootstrap中datetimepicker只选择月份显示1899问题

直接修改bootstrap-datetimepicker.js中

update: function () {
var date, fromArgs = false;
if (arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {
date = arguments[0];
fromArgs = true;
} else {
//这里加了个判断,原来只有else部分,增加了对自定义格式的处理
if (this.element.val().length == 6) {
date = this.element.val().substring(0, 4) + "-" + this.element.val().substring(4, 6) + "-01";
} else {
date = (this.isInput ? this.element.val() : this.element.find('input').val()) || this.element.data('date') || this.initialDate;
if (typeof date == 'string' || date instanceof String) {
date = date.replace(/^\s+|\s+$/g, '');
}
}
} if (!date) {
date = new Date();
fromArgs = false;
} this.date = DPGlobal.parseDate(date, this.format, this.language, this.formatType); if (fromArgs) this.setValue(); if (this.date < this.startDate) {
this.viewDate = new Date(this.startDate);
} else if (this.date > this.endDate) {
this.viewDate = new Date(this.endDate);
} else {
this.viewDate = new Date(this.date);
}
this.fill();
}
上一篇:kafka命令行脚本使用


下一篇:关于antd 日期组件只选择年份,设置mode=year无法获取value的解决办法