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

Accepted Answer
0 votes
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
Community showcase
Posted Oct 11, 2018 in Marketplace Apps

You + one app + a desert island...

Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...

2,461 views 5 6
Join discussion

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