parent
d966729f7e
commit
d23db35657
1 changed files with 0 additions and 21 deletions
@ -1,21 +0,0 @@ |
||||
module.exports = { |
||||
age: age, |
||||
} |
||||
|
||||
function age() { |
||||
let birthdate = new Date(2002, 8, 29) |
||||
let now = new Date() |
||||
|
||||
let age = now.getFullYear() - birthdate.getFullYear() |
||||
|
||||
if (now.getMonth() < birthdate.getMonth()) { |
||||
age-- |
||||
} |
||||
if ( |
||||
birthdate.getMonth() === now.getMonth() && |
||||
now.getDate() < birthdate.getDate() |
||||
) { |
||||
age-- |
||||
} |
||||
return age |
||||
} |
Loading…
Reference in new issue