提交 a9572ce3a60be28a1333c18eefbc621de34fd4f6

作者 pangy
1 个父辈 fafee59e

修复 获取年龄日期错误

正在显示 1 个修改的文件 包含 2 行增加3 行删除
@@ -65,7 +65,6 @@ function curDateTime() { @@ -65,7 +65,6 @@ function curDateTime() {
65 var year = d.getFullYear(); 65 var year = d.getFullYear();
66 var month = d.getMonth() + 1; 66 var month = d.getMonth() + 1;
67 var date = d.getDate(); 67 var date = d.getDate();
68 - var day = d.getDay();  
69 var curDateTime = year; 68 var curDateTime = year;
70 if (month > 9) 69 if (month > 9)
71 curDateTime = curDateTime + "-" + month; 70 curDateTime = curDateTime + "-" + month;
@@ -130,7 +129,7 @@ function analyzeIDCard(IDCard){ @@ -130,7 +129,7 @@ function analyzeIDCard(IDCard){
130 //获取当前年月日并计算年龄 129 //获取当前年月日并计算年龄
131 var myDate = new Date(); 130 var myDate = new Date();
132 var monthNow = myDate.getMonth() + 1; 131 var monthNow = myDate.getMonth() + 1;
133 - var dayNow = myDate.getDay(); 132 + var dayNow = myDate.getDate();
134 var age = myDate.getFullYear() - yearBirth; 133 var age = myDate.getFullYear() - yearBirth;
135 if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) { 134 if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) {
136 age--; 135 age--;
@@ -162,7 +161,7 @@ function getAge(birthdate) { @@ -162,7 +161,7 @@ function getAge(birthdate) {
162 //获取当前年月日并计算年龄 161 //获取当前年月日并计算年龄
163 var myDate = new Date(); 162 var myDate = new Date();
164 var monthNow = myDate.getMonth() + 1; 163 var monthNow = myDate.getMonth() + 1;
165 - var dayNow = myDate.getDay(); 164 + var dayNow = myDate.getDate();
166 var age = myDate.getFullYear() - yearBirth; 165 var age = myDate.getFullYear() - yearBirth;
167 if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) { 166 if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) {
168 age--; 167 age--;
注册登录 后发表评论