IE浏览器下对比两个时间大小
由于IE中new Date 存在兼容问题所以new Date .getTime 无法使用
timeInitialize(){
if(this.startTime && this.endTime){
var dateTime = this.strToDate(this.startTime);
var timeValue = Date.parse(dateTime);
var dateTime2 = this.strToDate(this.endTime);
var timeValue2 = Date.parse(dateTime2);
if(timeValue>timeValue2){
this.$message.error('请输出正确的查询时间')
return
}else{
this.initialize()
}
}
},
isEmpty(fData) {
let _this=this
if (typeof fData == "function") {
return false;
}
return typeof fData == "undefined" || fData == undefined || fData == null ||
fData.length == 0 || fData == 'null' || (fData != false && fData == '');
},
isNull : function(fData, replaceData) {
let _this=this
return _this.isEmpty(fData) ? replaceData : fData;
},
strToDate(str) {
let _this=this
if (_this.isEmpty(str)) {
return null;
}
var converted = Date.parse(str);
var myDate = new Date(converted);
if (isNaN(myDate)) {
if (str.indexOf(":") != -1) {
str = str.replace(" ", "-");
str = str.replace(":", "-");
str = str.replace(":", "-");
var arys = str.split('-');
myDate = new Date(arys[0], --arys[1], arys[2], _this.isNull(arys[3], 0),
_this.isNull(arys[4], 0), _this.isNull(arys[5], 0));
} else {
var arys = str.split('-');
myDate = new Date(arys[0], --arys[1], arys[2]);
}
}
return myDate;
},