js 判断日期大小
?
//獲取當前時間,格式YYYY-MM-DD
function getNowFormatDate() {
? ? var date = new Date();
? ? var seperator1 = "-";
? ? var year = date.getFullYear();
? ? var month = date.getMonth() + 1;
? ? var strDate = date.getDate();
? ? if (month >= 1 && month <= 9) {
? ? ? ? month = "0" + month;
? ? }
? ? if (strDate >= 0 && strDate <= 9) {
? ? ? ? strDate = "0" + strDate;
? ? }
? ? var currentdate = year + seperator1 + month + seperator1 + strDate;
? ? return currentdate;
}
?
var outTime = $("#outTime").val();//正式離職時間
?? ?if(outTime == '' || outTime == null ||outTime== undefined ){
?? ??? ?topWinWarning("請填寫正式離職時間!",$("#outTime"));
?? ??? ?return false;
?? ?}else{
?? ??? ?debugger;
?? ??? ?//日期不能小于當前日期
?? ??? ?var v_outDate = outTime+" 00:00:00";
?? ??? ?var v_nowDate = getNowFormatDate()+" 00:00:00";
?? ??? ?if(v_outDate !="" && v_nowDate !=""){
?? ??? ??? ?var od = new Date(v_outDate.replace(/-/g, "/"));?
?? ??? ??? ?var nd = new Date(v_nowDate.replace(/-/g, "/"));?
?? ??? ??? ?if(nd < od){
?? ??? ??? ?}else{
?? ??? ??? ??? ?$.messager.alert('提示','正式離職日期必須大于當前日期!','warning');
?? ??? ??? ??? ?return false;
?? ??? ??? ?}
?? ??? ?}
?? ??? ?
?? ?}
總結
- 上一篇: 震惊!评审专家将论文拒稿后修改发表
- 下一篇: 如何推送和播放RTMP H265流 (R