Using variables for date comparison in Automation results in incorrect outputs

XMLWordPrintable

    • Severity 3 - Minor
    • Jira Software

      Issue Summary

      There is an issue with smart value comparison in Automation. Comparing two date fields using variables results in unexpected outputs. The compareTo function is being used.

      When comparing the fields directly, the result is correct. However, using variables the function is returning incorrect results.

      Steps to Reproduce

      1. Create an issue in Jira Cloud with two date picker fields, e.g., "Start date" and "Due date". Set both fields to the same value, such as 2025-08-01.
      2. Use the smart value expression {{issue.Start date.compareTo(issue.Due date)}}. Observe that the result is 0, indicating correct comparison.
      3. Create variables {{startDateVar}} and {{dueDateVar}}, assigning them {{issue.Start date}} and {{issue.Due date}}, respectively.
      4. Use the expression {{startDateVar.compareTo(dueDateVar)}}. Observe that it returns an empty result.
      5. Use the expression {{startDateVar.toDate.compareTo(dueDateVar.toDate)}}. Observe that it incorrectly returns 14 instead of the expected 0.

      Expected Results

      The compareTo method should return 0 when both dates are the same, regardless of whether direct fields or variables are used for comparison.

      Actual Results

      The compareTo method returns 14 when using variables with .toDate, indicating a discrepancy in the date comparison.

      Workaround

      Currently there is no known workaround for this behavior. 

            Assignee:
            Unassigned
            Reporter:
            Lucy
            Votes:
            7 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: