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.
Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.
Register today!Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.