How do use smart rules diff for Target start and Target end date field
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
I'm trying to compare two dates with each other. For example, comparing the Resolution date with the Target start/end date.
When I try to use the following function to compare Resolution date with the Created date, the automation is working:
{{issue.resolutiondate.diff(issue.created).prettyPrint}}
When I try to compare with Resolution date with Target start/end date, it does not work
{{issue.resolutiondate.diff(issue.Target end).prettyPrint}}
Cause
Currently, the "Target end" and "Target start" custom field is not built under a date-time field type due to the field has its own unique field type from the Advanced Roadmaps app.
Solution
To work around the issue, you may want to convert the target end field object value to a date format.
{{issue.resolutiondate.diff(issue.Target end.toDate("yyyy-MM-dd")).prettyPrint}}
For more information about the diff function, please take a look at the date and time functions.