function checkAuditTime(beginTime,endTime){
var nowDate=new Date();
var beginDate=new Date(nowDate);
var endDate=new Date(nowDate);
var beginIndex=beginTime.lastIndexOf(":");
var beginHour=beginTime.substring(0,beginIndex);
var beginMinue=beginTime.substring(beginIndex+1,beginTime.length);
beginDate.setHours(beginHour,beginMinue, 0, 0);
var endIndex=endTime.lastIndexOf(":");
var endHour=endTime.substring(0,endIndex);
var endMinue=endTime.substring(endIndex+1,endTime.length);
endDate.setHours(endHour, endMinue, 0, 0);
if(nowDate.getTime()-beginDate.getTime()>=0 && nowDate.getTime() <= endDate.getTime()){
return 1;
}else{
return 2;
}
}
var flag= checkAuditTime("11:30","20:30");
转载https://blog.csdn.net/qq53167889/article/details/99717258