fix(math): age calculation logic
This commit is contained in:
parent
7f5df0b4b2
commit
e8fc605cf9
@ -1,4 +1,6 @@
|
|||||||
export function calculateAge(birthDate: Date) {
|
export function calculateAge(birthDate: Date) {
|
||||||
|
birthDate.setMonth(birthDate.getMonth() - 1);
|
||||||
|
|
||||||
let today = new Date();
|
let today = new Date();
|
||||||
let years = today.getFullYear() - birthDate.getFullYear();
|
let years = today.getFullYear() - birthDate.getFullYear();
|
||||||
let months = today.getMonth() - birthDate.getMonth();
|
let months = today.getMonth() - birthDate.getMonth();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user