Line 0
Link Here
|
0 |
- |
1 |
<!-- js-patron-get-age.inc --> |
|
|
2 |
<script> |
3 |
(function() { |
4 |
|
5 |
window.$get_age = function(dob, options) { |
6 |
if(!dob) return ''; |
7 |
|
8 |
var today = new Date(); |
9 |
dob = new Date(dob); |
10 |
var age = today.getFullYear() - dob.getFullYear(); |
11 |
var m = today.getMonth() - dob.getMonth(); |
12 |
if (m < 0 || (m === 0 && today.getDate() < dob.getDate())) { |
13 |
age--; |
14 |
} |
15 |
return age; |
16 |
} |
17 |
|
18 |
})(); |
19 |
</script> |
20 |
<!-- / js-patron-get-age.inc --> |