日期:2014-05-16  浏览次数:20366 次

js判断身份证是儿童或者成人
/**
	   *判断成人和儿童
	   */
	   judgeAge : function(idCard) {
	   		var result = "";
	        var birthDayDate = parseInt(this.getBirthdayFromIdCard(idCard).replace(/-/g,""),10);
    	    var fDate = _STAGE.flightNoInfo.fDate;
    		
    		var twelveAgeDate = parseInt(((fDate.substr(0,4)*1-12) + fDate.substr(4)).replace(/-/g,""),10);
            var twoAgeDate = parseInt(((fDate.substr(0,4)*1-2) + fDate.substr(4)).replace(/-/g,""),10);
    		 
            // 儿童机票规定:年龄2-12周岁(个别航空公司不执行此标准),以起飞日期为准
			if(birthDayDate <= twelveAgeDate){
    		  result = _STAGE.passengerPsgType.ADT;
    		} else if((birthDayDate <= twoAgeDate ) && (birthDayDate > twelveAgeDate)){
    		  result = _STAGE.passengerPsgType.CHD;
    		} else {
    		  result = _STAGE.passengerPsgType.ETC;
    		}
			
			return result;
	   },

?