Hi, I´m trying to set up a post function script where the Enddate will be set to the end of the current month.
The actual script considers the currentdate value +30days.
Has anyone got an idea to change the +30 to endOfMonth?
import com.atlassian.jira.component.ComponentAccessor
import java.sql.Date
import java.sql.Timestamp
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import org.apache.log4j.Logger
import org.apache.log4j.Level
// Manager
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
//Values
CustomField currentDate = customFieldManager.getCustomFieldObject("customfield_11808")
Timestamp currentDateValue = (Timestamp)issue.getCustomFieldValue(currentDate)
Date newDateValue = new Date(currentDateValue.getTime())
//Add 1 month
newDateValue.setMonth(currentDateValue.getMonth() +1)
//Update custom field
issue.setCustomFieldValue(currentDate, newDateValue.toTimestamp())