How to create automation for due date to be in business hours
Asked by Aryeh Schwob:

I am creating an automation for when an issue is transitioned to a new status it gets assigned a due date of for example 5 hours. I'm using smart date of {{now.PlusBusinessHours(5)}}

How do I set our business hours in Jira to 8am-5pm which will make the issue if assigned at 4:30pm have a due date of the next business day at 12:30pm?

Thank you!


Answers:
author: Mark Segall
body: Hi [@Aryeh Schwob](/t5/user/viewprofilepage/user-id/5080795) - Calculating Business Hours is going to be tricky because Jira Business Days are statically set to M-F 9:00 - 6:00. If it's even possible, you would need to have a complex calculation based upon **Days**, factoring in weekends.

Is this a JSM project by chance? If so, you could make use of SLAs because they allow custom calendars (not to mention exclusion days for holidays) which would do all of this dynamically.

comments: author: Aryeh Schwob
body: Hi [@Mark Segall](/t5/user/viewprofilepage/user-id/4666637)

9-6 can work too, its a Jira Work Management project. For now it will be easier to work with a 9-6 than to figure out a workaround.

Is there Documentation available for for how JIra statically calculates business days and hours?

Thank you!


author: Mark Segall
body: Take a look at [THIS QUESTION](https://community.atlassian.com/t5/Jira-Software-questions/Calculate-how-much-business-time-it-happens-between-2-dates/qaq-p/2123231) that I answered previously. It shows how you can convert business days into hours.


author: Aryeh Schwob
body: There is another issue that I ran into in that the duedate field only accepts dd/mm/yyyy and I'm trying to give it hours as the due date. Is there a field for that or do I have to create a custom field to show a due hour?

Again the project is a Jira work management project.

Thank you


author: Mark Segall
body: Correct, Due Date is a date only field so if you need to capture down to a specific time, you'll need to replace with a custom date/time field.


author: Kateryna_v_SaaSJet_
body: Hi [@Aryeh Schwob](/t5/user/viewprofilepage/user-id/5080795)

If you are not against using third-party add-ons, then the following solution can be implemented with the [SLA Time and Report for Jira add-on](https://marketplace.atlassian.com/apps/1220741/sla-time-and-report-for-jira?tab=overview&hosting=cloud&utm_source=Atlassian_community&utm_medium=referral&utm_campaign=Comment_How-to-create-automation-for-due-date-to-be-in-business-hours&utm_term=20230430):  
1) Create a calendar according to your schedule, considering holidays and holidays.  
![7_2023-04-30_8-19-04.png](https://community.atlassian.com/t5/image/serverpage/image-id/254618i44D9FE885A8D4A89/image-size/large?v=v2&px=999 "7_2023-04-30_8-19-04.png")  
2) Set up a new SLA configuration according to the created calendar.  
Select the Issue Created to Start condition, for Stop - all closing or resolving statuses, and put all others to Reset SLA.  
Set the SLA goal to 5 hours and an action -- change the priority to critical.

![8_2023-04-30_8-19-04.png](https://community.atlassian.com/t5/image/serverpage/image-id/254619iEFF112E652B8B80D/image-size/large?v=v2&px=999 "8_2023-04-30_8-19-04.png")  
Thus, when the status of the ticket changes, SLA will be restarted each time and start counting a new 5 hours until the issue is resolved. It will be calculated exclusively within the working hours of your calendar. When the issue is closed, SLA will also stop counting.

I hope this helps you.


Tags: cloud