Comparing Issue dates in Jira Automation
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.
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.
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.
Was this helpful?