Forums

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

Setting Target Start / End Dates with Business Days Calculation

Steve Tedeschi
Contributor
January 21, 2024

I am trying to set the Target End Date for an initiative 5 business days after an epic ends. I can read the Target End property by name or by custom field id (e.g., customfield_123456). However, when I try to modify the value using "plusBusinessDays" it errors out.

I've added the following "logging" comment:

issue.customfield_123456 = {{issue.customfield_123456}}
issue.customfield_123456.plusBusinessDays(1) = {{issue.customfield_123456.plusBusinessDays(1)}}
issue.customfield_123456.plusBusinessDays(1).jiraDate = {{issue.customfield_123456.plusBusinessDays(1).jiraDate}}

issue.Target End = {{issue.Target End}}
issue.Target End.plusBusinessDays(1) = {{issue.Target End.plusBusinessDays(1)}}
issue.Target End.plusBusinessDays(1).jiraDate = {{issue.Target End.plusBusinessDays(1).jiraDate}}


Here is the output:

issue.customfield_123456 = 2024-02-03
issue.customfield_123456.plusBusinessDays(1) =
issue.customfield_123456.plusBusinessDays(1).jiraDate =

issue.Target End = 2024-02-03
issue.Target End.plusBusinessDays(1) =
issue.Target End.plusBusinessDays(1).jiraDate =

1 answer

1 accepted

1 vote
Answer accepted
Matthias Gaiser _K15t_
Community Champion
January 22, 2024

Hi @Steve Tedeschi

the problem is that the Target End Date is no real date field from Jira's perspective. You first need to parse the value to a date and then you're able to add the business days. Here's my example for a logging statement:

due date = {{issue.Target end}}, plus business days = {{issue.Target end.toDate.plusBusinessDays(2)}}

Cheers,
Matthias

Steve Tedeschi
Contributor
January 22, 2024

Thanks @Matthias Gaiser _K15t_ worked like a charm! Appreciate your quick help!!!

Like Matthias Gaiser _K15t_ likes this
Matthias Gaiser _K15t_
Community Champion
January 22, 2024

That's great to hear!

In order to help other users find answers quicker, please mark this answer as accepted ✅.

Suggest an answer

Log in or Sign up to answer