Forums

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

how to exclude german holidays in a date script field in jira

Goutam Nemalpuri November 26, 2019 edited

Hi All,

I have created a script field to calculate the status duration of an issue. But i want to exclude all the German holidays from the calculation.

Could any one please help me how to do this.

Below is the script to calculate status duration.

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.history.ChangeItemBean

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()

def inProgressName = "status_name" List<Long> rt = [0L]

def changeItems = changeHistoryManager.getChangeItemsForField(issue, "status") changeItems.reverse().each { ChangeItemBean item ->

        def timeDiff = System.currentTimeMillis() - item.created.getTime()

        if (item.fromString == inProgressName) {

            rt << -timeDiff

         }

        if (item.toString == inProgressName) {

            rt << timeDiff

        }

}

def total = rt.sum() as Long

return (total / 1000) as long ?: 0L

 

Regards,

Goutam

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, out of office, loom, confluence, async collaboration, meeting recaps, remote teamwork, team alignment, knowledge sharing, AI-powered notes, productivity tools, workforce continuity, teamwork collection

Put your meeting notes on autopilot with Loom + Confluence

AI-powered meeting notes keep work moving even if you’re out of the office. Enjoy your well-deserved time off and return refreshed, confident you’ll catch up in no time.

Learn more
AUG Leaders

Atlassian Community Events