SIL Script Custom Field show years only

Stas December 18, 2014

Hi, i'm using JIRA 6.3.9

I have day of birth, and i need to count person's age, so, i wrote:

interval age = currentDate() - customfield_10001;
return "age " + age + " years";

But it showing in format 2087w 14h 43m 28s

What i need to do to see years only?

1 answer

1 accepted

0 votes
Answer accepted
Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 18, 2014

We didn't create / expect such accessor for interval, we must admit this. You should do something like:

number ageinyears = floor(age["WEEK"]/52, 0);
return ageinyears;

check: http://confluence.kepler-rominfo.com/display/SIL30/Operators

Another option is to substract year(currentDate()) - year(date), but you must check if birthday of the person already passed this year or not in order to correct it.

Suggest an answer

Log in or Sign up to answer