Help with Date Functions

Bill Schmitz August 23, 2017

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 votes
Answer accepted
Nick Menere
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.
August 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

Bill Schmitz August 30, 2017

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events