Hi,
I am trying to use Automation and Smart Values to automatically calculate the number of days between a date and the end of the year of the same date.
For example, if the date field value is 23/Jun/2024. I would like to know how many days are between that and 31/Dec/2024.
Hello @Francesco Borgosano
What have you tried?
You can get the difference between two dates using the diff function.
{{[date1].diff([date2]).[unit]}}
Reference this document:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time
If you need to construct the year-end date based on the Year specified in the date field use the format function on the date field to get the year. Example:
{{issue.created.format("yyyy")}}
Substitute your date field for "created".
Combine this with the day and month to get the year-end date, and use that to set a variable.
That variable is a string so when you use it in the date diff function you need to convert it to a date.
{{now().diff(yearEnd.toDate).Days}}
Hi @Trudy Claspill,
thanks for your reply. Your solution worked!
And I found particularly insightful and elegant your solution with the concept of creating a local variable. It gave me other ideas for further automation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.