Created
January 23, 2015 22:04
-
-
Save oidacra/a5dd7125c116549f547f to your computer and use it in GitHub Desktop.
Calcular Edad JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Kristoffer Dorph | |
function calcAge(dateString) { | |
var birthday = +new Date(dateString); | |
return~~ ((Date.now() - birthday) / (31557600000)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment