XF 2.1 Calculate Age

Cupara

Well-known member
Is there a way to calculate a person's age without them having checked Show Birth Year in account details?

I know
Code:
$xf.visitor.Profile.birthday.age
does this but it requires Show Birth Year checked for this to work. I need to know if I can grab dob_day, dob_month, dob_year and calculate it in the template on the fly.
 
Tried that and I get
Code:
Template errors
[LIST]
[*]Template public:forum_view: Cannot call method getAge on a non-object (array) (src/XF/Template/Templater.php:970)
[*]Template public:forum_view: Cannot call method getAge on a non-object (array) (src/XF/Template/Templater.php:970)
[/LIST]
at the top of my page.
 
Back
Top Bottom