En-/decryption fixed
This commit is contained in:
10
backend/utils/userdata.js
Normal file
10
backend/utils/userdata.js
Normal file
@@ -0,0 +1,10 @@
|
||||
export const calculateAge = (birthdate) => {
|
||||
const today = new Date();
|
||||
const birthDate = new Date(birthdate);
|
||||
let age = today.getFullYear() - birthDate.getFullYear();
|
||||
const monthDiff = today.getMonth() - birthDate.getMonth();
|
||||
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
|
||||
age--;
|
||||
}
|
||||
return age;
|
||||
};
|
||||
Reference in New Issue
Block a user