diff --git a/packageA/pages/profile/profile.js b/packageA/pages/profile/profile.js index e0b63cf..31caaab 100644 --- a/packageA/pages/profile/profile.js +++ b/packageA/pages/profile/profile.js @@ -1159,22 +1159,43 @@ Page({ console.log(e); let b = this.getInput(e); let reg=/^[0-9\-]*$/ + // let reg=/^\d{4}-\d{1,2}-\d{1,2}$/ if (!(reg.test(b))){ return this.data.oldbirthday } + let length = b.length; let oldBirtthDayLength=this.data.oldBirtthDayLength if (length > oldBirtthDayLength) { + if (b.length==4) { b+='-' } + if (b.length==6 && b[5] >1) { + console.log(b[5]); + return this.data.oldbirthday + } + if (b.length==7) { - b+='-' + if (b[6]=='-') { + let lb = b.split(''); + lb.splice(5, 0, 0); + b = lb.join(''); + }else{ + b+='-' + } + + } + + if (b.length==10) { + let a=b[8]+b[9]; + if (a*1>31) { + return this.data.oldbirthday + } } - // if (b.length==6 && b[5] >1) { - // console.log(b[5]); - // } + + } this.setData({ datet: b,