通常保险会用周岁计算。用今天的年份减去被保险人出生的年份。没过生日再减一岁即可。例如被保险人是1965年1月28日出生,就用2014减去1965等于49,到今天生日还没过,那么就是48周岁。
getAge(birDay) { let birthdays = new Date(birDay.replace(/-/g, "/")) let d = new Date() let age = d.getFullYear() - birthdays.getFullYear() - (d.getMonth() < birthdays.getMonth() || (d.getMonth() == birthdays.getMonth() && d.getDate() < birthdays.getDate())?1:0); return age },
只需要精确到年,例如今年-出生年份,就是岁数
getAge(birDay) { let birthdays = new Date(birDay.replace(/-/g, "/")) let d = new Date() let age =d.getFullYear() -birthdays.getFullYear() return age },