js 判断时间大小
//判断结束时间一定要大于开始时间 function comparativeTime(){ var isok=true; //早餐配送时间 var breakfastScanTimeMin = $("#breakfastScanTimeMin").val(); var breakfastScanTimeMax = $("#breakfastScanTimeMax").val(); //早餐订餐时间 var breakfastBookTimeMin = $("#breakfastBookTimeMin").val(); var breakfastBookTimeMax = $("#breakfastBookTimeMax").val(); //午餐配送时间 var lunchScanTimeMin = $("#lunchScanTimeMin").val(); var lunchScanTimeMax = $("#lunchScanTimeMax").val(); //午餐订餐时间 var lunchBookTimeMin = $("#lunchBookTimeMin").val(); var lunchBookTimeMax = $("#lunchBookTimeMax").val(); //晚餐配送时间 var dinnerScanTimeMin = $("#dinnerScanTimeMin").val(); var dinnerScanTimeMax = $("#dinnerScanTimeMax").val(); //晚餐订餐时间 var dinnerBookTimeMin = $("#dinnerBookTimeMin").val(); var dinnerBookTimeMax = $("#dinnerBookTimeMax").val(); //宵夜扫码时间 var supperScanTimeMin = $("#supperScanTimeMin").val(); var supperScanTimeMax = $("#supperScanTimeMax").val(); //宵夜订餐时间 var supperBookTimeMin = $("#supperBookTimeMin").val(); var supperBookTimeMax = $("#supperBookTimeMax").val(); //便利店扫码时间 var facilitateScanTimeMin = $("#facilitateScanTimeMin").val(); var facilitateScanTimeMax = $("#facilitateScanTimeMax").val(); //便利店订餐时间 var facilitateBookTimeMin = $("#facilitateBookTimeMin").val(); var facilitateBookTimeMax = $("#facilitateBookTimeMax").val(); //下午茶扫码时间 var afternoonTeaScanTimeMin = $("#afternoonTeaScanTimeMin").val(); var afternoonTeaScanTimeMax = $("#afternoonTeaScanTimeMax").val(); //下午茶订餐时间 var afternoonTeaBookTimeMin = $("#afternoonTeaBookTimeMin").val(); var afternoonTeaBookTimeMax = $("#afternoonTeaBookTimeMax").val(); //判断时间大小 var myDate = new Date(); //早餐配送时间 var breakfastScanMin = myDate.toLocaleDateString()+breakfastScanTimeMin; var breakfastScanMax = myDate.toLocaleDateString()+breakfastScanTimeMax; //早餐订餐时间 var breakfastBookMin = myDate.toLocaleDateString()+breakfastBookTimeMin; var breakfastBookMax = myDate.toLocaleDateString()+breakfastBookTimeMax; //午餐配送时间 var lunchScanMin = myDate.toLocaleDateString()+lunchScanTimeMin; var lunchScanMax = myDate.toLocaleDateString()+lunchScanTimeMax; //午餐订餐时间 var lunchBookMin = myDate.toLocaleDateString()+lunchBookTimeMin; var lunchBookMax = myDate.toLocaleDateString()+lunchBookTimeMax; //晚餐配送时间 var dinnerScanMin = myDate.toLocaleDateString()+dinnerScanTimeMin; var dinnerScanMax = myDate.toLocaleDateString()+dinnerScanTimeMax; //晚餐订餐时间 var dinnerBookMin = myDate.toLocaleDateString()+dinnerBookTimeMin; var dinnerBookMax = myDate.toLocaleDateString()+dinnerBookTimeMax; //宵夜扫码时间 var supperScanMin = myDate.toLocaleDateString()+supperScanTimeMin; var supperScanMax = myDate.toLocaleDateString()+supperScanTimeMax; //宵夜订餐时间 var supperBookMin = myDate.toLocaleDateString()+supperBookTimeMin; var supperBookMax = myDate.toLocaleDateString()+supperBookTimeMax; //便利店扫码时间 var facilitateScanMin = myDate.toLocaleDateString()+facilitateScanTimeMin; var facilitateScanMax = myDate.toLocaleDateString()+facilitateScanTimeMax; //便利店订餐时间 var facilitateBookMin = myDate.toLocaleDateString()+facilitateBookTimeMin; var facilitateBookMax = myDate.toLocaleDateString()+facilitateBookTimeMax; //下午茶扫码时间 var afternoonTeaScanMin = myDate.toLocaleDateString()+afternoonTeaScanTimeMin; var afternoonTeaScanMax = myDate.toLocaleDateString()+afternoonTeaScanTimeMax; //下午茶订餐时间 var afternoonTeaBookMin = myDate.toLocaleDateString()+afternoonTeaBookTimeMin; var afternoonTeaBookMax = myDate.toLocaleDateString()+afternoonTeaBookTimeMax; if(breakfastScanMin >= breakfastScanMax){ alert('早餐配送时间:结束时间不能小于开始时间'); isok=false; } if(breakfastBookMin >= breakfastBookMax){ alert('早餐订餐时间:结束时间不能小于开始时间') isok=false; } if(lunchScanMin >= lunchScanMax){ alert('午餐配送时间:结束时间不能小于开始时间') isok=false; } if(lunchBookMin >= lunchBookMax){ alert('午餐订餐时间:结束时间不能小于开始时间') isok=false; } if(dinnerScanMin >= dinnerScanMax){ alert('晚餐配送时间:结束时间不能小于开始时间') isok=false; } if(dinnerBookMin >= dinnerBookMax){ alert('晚餐订餐时间:结束时间不能小于开始时间') isok=false; } if(supperScanMin >= supperScanMax){ alert('宵夜扫码时间:结束时间不能小于开始时间') isok=false; } if(supperBookMin >= supperBookMax){ alert('宵夜订餐时间:结束时间不能小于开始时间') isok=false; } if(facilitateScanMin >= facilitateScanMax){ alert('便利店扫码时间:结束时间不能小于开始时间') isok=false; } if(facilitateBookMin >= facilitateBookMax){ alert('便利店订餐时间:结束时间不能小于开始时间') isok=false; } if(afternoonTeaScanMin >= afternoonTeaScanMax){ alert('下午茶扫码时间:结束时间不能小于开始时间') isok=false; } if(afternoonTeaBookMin >= afternoonTeaBookMax){ alert('下午茶订餐时间:结束时间不能小于开始时间') isok=false; } return isok; }