From e8fc605cf93f74dac50a39a9aed57c5d7be4e23f Mon Sep 17 00:00:00 2001 From: Franek Date: Sat, 26 Apr 2025 15:00:58 +0200 Subject: [PATCH] fix(math): age calculation logic --- src/utils/math.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/math.ts b/src/utils/math.ts index 37a35a0..06a5b6e 100644 --- a/src/utils/math.ts +++ b/src/utils/math.ts @@ -1,4 +1,6 @@ export function calculateAge(birthDate: Date) { + birthDate.setMonth(birthDate.getMonth() - 1); + let today = new Date(); let years = today.getFullYear() - birthDate.getFullYear(); let months = today.getMonth() - birthDate.getMonth();