It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Automatically set expected Due Date to issue, exclude weekends and holidays

Hi everyone

I am trying to update my expected Due Date from the Created Date.(Created date+5)
I want to exclude weekends (Saturday and Sunday) when calculating the Expected Due Date.
Is there any way to Calculate due date except Saturday, Sunday and holidays??

2 answers

1 accepted

0 votes
Answer accepted
Antoine Berry Community Leader Sep 23, 2019

Hi @Vrushali Hasbe ,

This should be of good help.


Hi @Antoine Berry  

Thanks for the solution.

I have use your solution also But i can't able to update due date for issue and also my Due date custom field is present on view issue screen. I have attached the screenshot. please check it and tell me where i am wrong.

Due Date post function1.jpgDue Date Post Function.jpgDue Date Issue.jpg

Antoine Berry Community Leader Sep 25, 2019

Hi @Vrushali Hasbe ,

Please use this script : 

Calendar c1 = GregorianCalendar.getInstance();
c1.setTime(new Date())

for(int i=1;i<=5;i++){
c1.add(Calendar.DAY_OF_MONTH, 1);
if (c1.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
c1.add(Calendar.DAY_OF_MONTH, 1);
if (c1.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
c1.add(Calendar.DAY_OF_MONTH, 1);



hii @Antoine Berry 

Thank you very much for your script and it is working fine for me.

Antoine Berry Community Leader Sep 26, 2019

Hi @Vrushali Hasbe , glad it worked out. Please make sure to accept the answer so it can help others too.

Hi @Andrew 

I am using Scriptrunner plugin for Jira plugin.

And also I have tried script that I have found online but it do not work for me.

I want to set due excluding Saturday and Sunday and public holidays

Suppose Today i have created one issue then my due date will be current date+2.
If i create issue on Friday means my due date will be (current date+2) but excluding Saturday and Sunday. means the date present on Tuesday.

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you