File size: 179 Bytes
fc659a3
 
 
 
 
1
2
3
4
5
6
export const calcAge = (dob: Date): number => {
  const diff = Date.now() - dob.getTime();
  const ageDate = new Date(diff);
  return Math.abs(ageDate.getUTCFullYear() - 1970);
}