将已知年月日转时间戳,如果以以下代码转,ios会报错,但安卓是ok的:
let BirthDate = new Date(this.birthYear + '-' + this.birthMonth + '-' + this.birthDay);
ch.birthday = BirthDate.getTime() / 1000;
ios报错:
BirthDate :Invalid Date
ch.birthday: NaN,
解决办法:将短横线改为斜线
let BirthDate = new Date(this.birthYear + '/' + this.birthMonth + '/' + this.birthDay);
如此即可!