`谷歌浏览器支持的日期格式是2019-6-25,2019/6/25这些,IE、火狐浏览器只支持2019/6/25这种格式,所以需要用正则replace(/-/g,"/"),把“-”转化为“/”,这样IE、火狐浏览器能识别。
assessmentEnd = assessmentEnd.replace(/-/g,"/");//替换字符,变成标准格式
laydate.render({
elem: '#dateRange03'
,trigger: 'click' //采用click弹出
,done: function(value){
var assessment1 = new Date(Date.parse(assessmentStart));
assessmentEnd=value;
assessmentEnd = assessmentEnd.replace(/-/g,"/");//替换字符,变成标准格式
var assessment2 = new Date(Date.parse(assessmentEnd));
if (assessment2<assessment1){
layer.alert('评估到期不能小于评估日期!', {icon: 2});
$("#dateRange03").val("");
}
}
});