Calculated date field Add days

EL October 24, 2013

Hi

How can I display a date based on another dates

If dateB > date A

Calculated date field = dateA+10 days

Else

Calculated date field = dateB+10 days

Thanks for support

3 answers

1 accepted

2 votes
Answer accepted
David _old account_
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.
October 24, 2013

You could try something like:

dateA = issue.get("customfield_10000");
dateB = issue.get("customfield_10001");
if (dateA==null && dateB==null)
  return null;
if (dateA==null || dateB!=null && dateA.after(dateB))
  return org.apache.commons.lang.time.DateUtils.addDays(dateB, 10);
return org.apache.commons.lang.time.DateUtils.addDays(dateA, 10);

where customfield_10000 and customfield_10001 are the field IDs of your two Date fields.

Note that I haven't tried the formula so it might be slightly wrong.

You can check atlassian-jira.log for ERRORs (look for com.innovalog).

0 votes
EL November 3, 2013

Thanks for support David.

I tried the formula, and in my case the result of the the calculated date field is "In X days", which is okay for the moment.

I thaught we can get something like New date = date + 10 days. So new date = 01/11/2013 + 10 days = 11/11/2013

I will retry this later

0 votes
David _old account_
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.
October 24, 2013
EL October 24, 2013

Thanks for advise

I had a look on both issues but I did not get the result I wanted

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events