How to set the due date to future date in jelly script

Hello,

I have a jelly script that creates Issues. I want to set the Due Date field to the current Date + 30 days. I can get the current date using the code below, but can anyone tell me how to add 30 days to the current date (in the code below both timestamp and formattedDate give me the current date)?

Thanks,

Mike

<core:new className="java.util.Date" var="timestamp" />
<core:new className="java.text.SimpleDateFormat" var="format">
<core:arg type="java.lang.String" value="yyyy-MM-dd" />
</core:new>
<core:invokeStatic className="java.util.TimeZone" method="getTimeZone" var="timezone">
<core:arg type="java.lang.String" value="GMT" />
</core:invokeStatic>
<core:invoke on="${format}" var="formattedDate" method="setTimeZone">
<core:arg type="java.util.TimeZone" value="${timezone}" />
</core:invoke>
<core:invoke on="${format}" var="formattedDate" method="format">
<core:arg type="java.util.Date" value="${timestamp}" />
</core:invoke>

2 answers

1 accepted

I was able to get it to work... now when I auto create an issue with a jelly script the due date is automatically set to the current date + 30 days with the code below...

<core:invokeStatic className="java.util.Calendar" method="getInstance" var="CalendarField"/>

<core:invoke on="${CalendarField}" method="add" var="StartDate">
<core:arg type="int" value="7"/>
<core:arg type="int" value="30" />
</core:invoke>

Hope this helps someone.

Mike

Hi Mike - any chance you can share the full script? Or how the first part you posted and the second part go together?

Essentially, i'm trying to create an issue with Jelly, with the date in the summary. I used the first part from above to get this working fine (Thanks!), but what I want to do next is change it to me tomorrow's date rather than today.

Thanks very much

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

418 views 6 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you