Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Need help calculating time in each status

Леонид February 4, 2025

My task was to display the time spent in each status like this (3 days 2 hours 11 minutes). I created a trigger that wrote down the "Last status change" custom field whenever the status changed.

Command: {{now}}

Изображение WhatsApp 2025-02-04 в 10.39.04_a6e5b690.jpg

I created a trigger and a custom field for each state, but got stuck on the calculation.

Command:

{{issue.Time of entry into new status.diff(now).days}} days

{{issue.Time of entry into new status.diff(now).hours.mod(24)}} hours

{{issue.Time of entry into new status.diff(now).minutes.mod(60)}} minutes

Изображение WhatsApp 2025-02-04 в 10.39.44_01ed0e96.jpg

The output I get is (1 days hours minutes) it only shows days

Please tell me where I went wrong or how this can be implemented.

 

And I apologize that my screenshots are in Russian, I hope this does not interfere

1 answer

2 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 4, 2025

Hi @Лёня Криволапов 

Rather than manually building that human-readable expression, please use the diff() function with the prettyPrint format: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-difference---

For example:

{{issue.some start datetime.diff(issue.some end datetime).prettyPrint}}

And...I believe there is no built-in modulo / mod function for automation rules.

Kind regards,
Bill

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 8, 2025

Hi @Лёня Криволапов 

Just following up to check if this answered your question.  If so, please consider marking this one as "answered".  That will help others with a similar need find solutions faster.  If not, please let the community know what help you need with the rule changes.

Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events