Forums

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

Can I get the difference between dates in business days as pretty print?

Lauren
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 16, 2023

I am trying to calculate the difference between Start Date and End Date and automatically fill in a custom field for time estimation purposes.

I have this automation working:

{{issue.start date.diff(issue.end date.plusDays(1)).prettyPrint}}

which will print out:

6 days

And I also have this automation working:

{{issue.start date.diff(issue.end date.plusDays(1)).businessDays}}

which will print out 

5.0

I've tried:

{{issue.start date.diff(issue.end date.plusDays(1)).prettyPrint.toBusinessDays()}}

{{issue.start date.diff(issue.end date.plusDays(1)).toBusinessDays().prettyPrint}}

{{issue.start date.diff(issue.end date.plusDays(1)).businessDays.prettyPrint}}

 

Is it possible to have business days but output as pretty print?

 

 

1 answer

1 accepted

0 votes
Answer accepted
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 16, 2023

Hi @Lauren Yoder -- Welcome to the Atlassian Community!

I suspect the answer is "no" for automation rules.

Both businessDays and prettyPrint are output modifiers for the diff() function.  And the output of businessDays is always whole integer days: https://confluence.atlassian.com/automation/jira-smart-values-date-and-time-993924864.html

So, what would "prettyPrint" even look like when those are chained in that context?  There is no unit of measure (I believe) for "business weeks", "business months", etc.

For your example, what would you expect to display for prettyPrint when the source is 6 business days?  If you can explain that, perhaps you could use math and conditional operators to produce your result.

Kind regards,
Bill

Lauren
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 21, 2023

Thank you! I ended up just using business days and appending "d" to the end of it so that the estimate field would accept it as days.

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer