Click the "Download" button below to retrieve a copy of this tag,
including the complete documentation and sample usage shown
on this page. Place the downloaded ".inc" file in your
LassoStartup folder, restart Lasso, and you can begin using this
tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
define_tag('age', -description='Returns age in years. By default the current date is used to determine age, but can be overridden by passing in a second date.',
-namespace='date_',
-required='dob', -type='date',
-optional='end', -type='date',
-priority='replace');
!local_defined('end') ? local('end') = date;
local('age') = #end->year - #dob->year - 1;
if((#end->month - #dob->month == 0 && #end->day - #dob->day >= 0)
|| #end->month - #dob->month > 0);
#age+=1;
/if;
return(#age);
/define_tag;