Comparing Issue dates in Jira Automation

Still need help?

The Atlassian Community is here for you.

Ask the community

robotsnoindex

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

This article explores the complexities of comparing date field values in Jira issues—like creation dates, due dates, and start dates—with fixed date strings. It highlights scenarios where it's essential to determine if an issue's date field value falls within a specified date range to trigger specific automated actions.

Diagnosis


The core of the issue lies in the fact that Jira Automation does not support direct date comparison using the < or > operators on dates formatted as strings. Instead, the dates need to be handled in a way that allows for numerical comparison or alternative methods for comparing dates.

Cause


The automation rule attempted to compare the issue's created date directly using string formats, such as {{dd/MM/yyyy}}, which Jira Automation cannot process for comparison operations. As a result, the rule could not accurately determine if the created date was greater than or less than the specified dates, leading to incorrect sprint assignments.

Solution

To address this issue, it is necessary to use Jira's built-in JQL (Jira Query Language) conditional rule, which can compare dates numerically. JQL accepts fixed dates as strings in specific formats that Jira can interpret correctly for comparisons. The acceptable date formats for JQL are 'yyyy/MM/dd', 'yyyy-MM-dd', 'yyyy/MM/dd', and 'yyyy-MM-dd'.

Below is an example of how to setup the rule:

Suppose the rule should assign issues to a sprint based on whether the creation date is after June 3, 2024, instead of using direct date comparisons in the automation rule, use JQL to handle the date comparisons.

To check if the issue's created date is greater than a specific date:

created > "2024-06-03"

To check if the issue's created date is less than a specific date:

created < "2024-06-03"



Jira Automation rules cannot directly compare date strings due to their treatment as non-numerical strings. Using JQL for date comparisons provides a viable workaround, allowing for accurate conditional checks and appropriate sprint assignments. This approach ensures that automation rules function as intended, avoiding incorrect sprint assignments based on creation dates.


Last modified on Sep 5, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.