Go to start of banner

# Example: Set "Due date" to a specific day of next week no matter of date of creation this week

We have a special issue type in Jira, which is like a small in sprint. The execution deadline is always the end of next week (next Friday actually), counting from the raise of the issue. And we would like to store the deadline in the issue, that should be calculated by the plugin.

So I can open an issue on Monday, another one on next day, etc. Both have deadline next Friday - actally every issue has the same due date that are opened in the same week. In the first case there are 10 days for the execution, in secound one there are only 9 days. That's what makes it difficult, because create date is flexible within a week, due date however should be fixed - thats the reason why I can not define x day shift between the create date and due date.

You should use configuration for behavior 1 adding 7 days to it, i.e., using the following time formula:

datePart({00057}, LOCAL) + (dayOfTheWeek({00057}, LOCAL) = 7 ? 7 + 6 : 7 + 6 - dayOfTheWeek({00057}, LOCAL)) * {DAY}

or for improved efficiency

datePart({00057}, LOCAL) + (dayOfTheWeek({00057}, LOCAL) = 7 ? 13 : 13 - dayOfTheWeek({00057}, LOCAL)) * {DAY}

You should add that post-function to "Create Issue" transition of your special sprint issue type's workflow. Take care to insert your post-function after "Creates the issue originallypost-function.
In case you are sharing the workflow with other issue types, you should use Set a field as a function of other fields post-function instead of Mathematical and date-time expression calculator, using the following configuration: You should replace name_of_special_sprint_issue_type with the actual name of your special sprint issue type.

Once configured, "Create Issue" transition will look like this: # Alternative implementation

Let's suppose that we want to set "Due date" to next Friday and if today's Friday to next Friday exactly 7 days later. This is not a so easy time calculus as it seems to be. I will explain you to how to do it using Mathematical and date-time expression calculator post-function.

There are two possible desired behaviors:

If today is Friday, we want to set "Due date" to current date (today). In this case we would use the following configuration: The time formula used is:

`datePart({00057}, LOCAL) + (dayOfTheWeek({00057}, LOCAL) = 7 ? 6 : 6 - dayOfTheWeek({00057}, LOCAL)) * {DAY}`

## Alternative expression

If today is Friday, we want to set "Due date" to next Friday, i.e., exactly 7 days later. In this case we would use the following time formula: The time formula used is:

`datePart({00057}, LOCAL) + (dayOfTheWeek({00057}, LOCAL) = 6 ? 7 : (dayOfTheWeek({00057}, LOCAL) = 7 ? 6 : 6 - dayOfTheWeek({00057}, LOCAL))) * {DAY}`

• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page:
• Page: