Hello All,
User inputs Start Date and No. of Days. Based on Start Date and No. of Days, End Date should be automatically displayed.
Field Types used:
Start Date (Date/Time Picker)
No. of Days(Numeric Type)
End Date(Date/Time Picker)
We are using Scriptrunner for JIRA. The script works fine and outputs End date correctly. Addition to this script, I am not able to exclude Saturday and Sunday.
Kindly suggest the changes to be implemented to ensure, the script excludes Saturday and Sunday and displays the End Date.
Kind Regards,
Prashant
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
Issue issue = issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
//Custom field defined for No of days
def daysToAddCF = customFieldManager.getCustomFieldObjectByName("QK Number of Days")
//custome field for defining Start Date
def dateACF = customFieldManager.getCustomFieldObjectByName("QK Start Date")
def dateAValue = issue.getCustomFieldValue(dateACF) as Date
def daysToAdd = issue.getCustomFieldValue(daysToAddCF) as int
def dateB = Calendar.getInstance()
dateB.setTime(dateAValue)
dateB.add(Calendar.DATE,daysToAdd)
return dateB.getTime()
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.