태어난 년도로 나이환산하기 (+ 만나이, 국내나이)

susu.J·2021년 7월 14일
0

여기서 row.birth가 태어난 년도를 뿌려준다.
ex) 1999-03-08

/국내 나이/

const today = new Date();
const birthDate = new Date(row.birth);
let birthToAge =
  today.getFullYear() - birthDate.getFullYear() + 1;

/만 나이/

const today = new Date();
const birthDate = new Date(row.birth);
let birthToAge =
  today.getFullYear() - birthDate.getFullYear();
profile
on the move 👉🏼 https://sjeong82.tistory.com/

0개의 댓글