1.时间类型:yyyy-MM-dd HH:mm:ss
参考:https://blog.youkuaiyun.com/guoquanyou/article/details/8226395
function checkEndTime(){
var startTime=$("#startTime").val();
var start=new Date(startTime.replace("-", "/").replace("-", "/"));
var endTime=$("#endTime").val();
var end=new Date(endTime.replace("-", "/").replace("-", "/"));
if(end<start){
return false;
}
return true;
}
2.时间类型:HH:mm:ss
//判断两个时间大小
function checkEndTime(startTime,endTime){
var start=new Date(startTime.replace(":", "/").replace(":", "/"));
console.log("2.比较时间大小=="+JSON.stringify(start));
var end=new Date(endTime.replace(":", "/").replace(":", "/"));
console.log("3.比较时间大小=="+JSON.stringify(end));
if(end<start){
return false;
}
return true;
}