Help with Date Functions

Hello, I'm new to this great add-on and am looking for a little help with date functions.

I've created some simple Create Issue tasks using the Recurring Tasks template and want to set their due dates. It looks as though I could accomplish this with the

{{#now}}func=plusDays(num days){{/now}}

function but am wondering if I can employ other functions to set the Due Date.

If I wanted to set the Due Date to May 1st of the current year (2017) would the function look like this:

{{#issue.due}}func=withDayOfMonth(1).withMonthOfYear(5){{/}}

If I wanted to set the Due Date to May 1, 2018 would the function look like this?

{{#issue.due}}func=withDayOfMonth(1).withMonthOfYear(5).withYear(2018){{/}}

Would these or some variation go right in the Due Date field or need to go in the additional fields area using JSON?

Also, am I correct that there are no existing functions for:

The last day of a specific month

The first business day of a specific month

The last business day of a specific month

Thank you

1 answer

1 accepted

0 vote
Nick Menere Community Champion Aug 23, 2017

Hi Bill,

 

Thanks for using Automation for Jira.

You are pretty much right on and these values can put into the Due Date field.

Here are some examples that you could use:

// 1st of may this year
{{#now}}func=withDayOfMonth(1).withMonthOfYear(5){{/}}


// 1st of may next year
{{#now}}func=withDayOfMonth(1).withMonthOfYear(5).plusYears(1){{/}}

// last day of May
{{#now}}func=withDayOfMonth(1).withMonthOfYear(6).minusDays(1){{/}}

// first business day in May
{{#now}}func=withDayOfMonth(1).withMonthOfYear(5).toBusinessDay(){{/}}

// last business day in May
{{#now}}func=withDayOfMonth(1).withMonthOfYear(6).minusDays(1).toBusinessDayBackwards(){{/}}

 

Hope that helps.

 

Cheers,

Nick

Very simple and straightforward.  Your help is much appreciated!  -Bill

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

268 views 0 6
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