Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing dates in Jira Automation

Jon Jain July 2, 2021

I have two date fields - Target Date and Due Date. I want to create an automation so that any issues where Due Date is after Target Date are flagged into a custom field.

Based upon some previous community posts, I've been testing out isAfter and date diff with smart values, using advanced compare, but haven't been successful yet.

Using advanced compare in Automation, I've used

{{issue.Due Date.isAfter(issue.Target End)}} 

equals

true

However, I haven't been able to get this comparison to return true yet.

Any suggestions?

2 answers

0 votes
John Funk
Community Champion
July 4, 2021

Hi Jon,

What I would do is create a custom number field where the difference between the two dates are stored. Then you can run a filter where that value is check to be greater than zero (or another number if you like.

So it would be a rule based on one of the fields being updated. 

Then have a new action for Edit issue and select the new number custom field. 

In the Set value area put in something like: {{issue.Due Date.diff(issue.Target Date).days}}

0 votes
Trudy Claspill
Community Champion
July 2, 2021

On this page

https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/

I found that the Due Date field is referenced using this

issue.duedate

 

Have you tried another date function, like

{{[date1].dif([date2]).[unit]}}

 

to confirm that the system can calculate that there is a difference between the dates?

Suggest an answer

Log in or Sign up to answer