Going Stellar

Home/Smart values reference

Jira Automation smart value

Comparing dates in Jira Automation: syntax and examples

isAfter() and isBefore() answer true or false for two dates. compareTo() gives a number that is negative, positive or zero. Use them in advanced compare conditions, for example to test whether a due date falls inside the next 30 days.

Syntax

{{date1.isAfter(date2)}}
{{date1.isBefore(date2)}}
{{date1.isEquals(date2)}}
{{date1.compareTo(date2)}}

Arguments

ArgumentWhat it isRequired
date2The date to compare with, such as now, issue.created or now.plusDays(30)yes

Works on

  • Fields: any two date or date-time values
  • Returns: true or false, or a number for compareTo()

Examples

{{issue.duedate.isAfter(now)}}

Tests whether the due date is still ahead.

Result:

true

Run on Jira Cloud on .

{{issue.duedate.isBefore(now.plusDays(30))}}

Tests whether the due date falls within the next 30 days; plusDays() builds the second date.

Result:

true

Run on Jira Cloud on .

{{issue.updated.isAfter(issue.created)}}

Tells whether the work item changed after it was created.

Result:

true

Run on Jira Cloud on .

{{issue.duedate.compareTo(issue.created)}}

Is positive when the second date is earlier than the first, for example the due date against the creation date.

Result:

1

Run on Jira Cloud on .

{{issue.created.compareTo(issue.duedate)}}

The reverse order gives a negative number.

Result:

-1

Run on Jira Cloud on .

{{issue.duedate.compareTo(issue.duedate)}}

Gives 0 for two equal date-only values.

Result:

0

Run on Jira Cloud on .

Where the documentation differs

  • {{issue.updated.isEquals(issue.created)}}

    Run on Jira Cloud, : the documentation says false, the actual result is .

  • {{now.compareTo(now)}}

    Run on Jira Cloud, : the documentation says 0, the actual result is 16.

Pitfalls

  • isEquals() rendered empty in every check, including a value compared with itself (issue.duedate.isEquals(issue.duedate)), so it cannot drive a rule today. Combine isAfter() and isBefore(), or compare with compareTo() (checked on Jira Cloud, November 2026).
  • compareTo() returns 1 or -1, not the size of the gap. For two identical date-times it gave 16 instead of 0 (issue.created.compareTo(issue.created)), while two equal due dates gave 0. Do not test for equality of date-times with it (checked on Jira Cloud, November 2026).
  • An argument that is not a date, such as now.isAfter(issue.summary), or a missing argument renders empty rather than false.
  • In a text field, {{#if(...)}}a{{else}}b{{/}} did not work as if/else: with a true condition it printed both a and b, with a false one it printed nothing (checked on Jira Cloud, November 2026). Branch with the compare condition instead.

Sources

  1. Jira smart values: date and time (Atlassian Support)
  2. Use smart values to manipulate and format dates (Atlassian Support)

Markdown version · All smart values