📅  最后修改于: 2022-03-11 14:55:06.378000             🧑  作者: Mango
const getAge = birthDate => Math.floor((new Date() - new Date(birthDate).getTime()) / 3.15576e+10)
// today is 2018-06-13
getAge('1994-06-14') // 23
getAge('1994-06-13') // 24