今天客户突然有个需求,有人值班时发一种短信模板,五人值班另一种短信模板,暂只实现了功能,后期实现到后台维护
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/csdn_xsx/article/details/52191621