function checkTime(obj){ var startTime= $(obj).parent().siblings().next().next().children().val();//到项目时间 var endTime= $(obj).parent().siblings().next().next().next().children().val();//离项目时间 var startDate=new Date(startTime.replace("-", "/").replace("-", "/")); var endDate=new Date(endTime.replace("-", "/").replace("-", "/")); var number = 0; var yearToMonth = (endDate.getFullYear() - startDate.getFullYear()) * 12; number += yearToMonth; monthToMonth = endDate.getMonth() - startDate.getMonth(); number += monthToMonth; //endDay = endDate.getDate(); //startDay = startDate.getDate(); //dayStep = endDay - startDay; //if (dayStep >= 0) { // if (dayStep >= 15) { // number += 1; // } //} else { // if (dayStep <= -15) { // number -= 1; // } //} $(obj).blur(); alert(parseInt(number + 1) + " 人月 "); return false; }
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/10034.html