Abstract
This code snippet adds a certain number of days to a Date field.
...
Placeholder | Description | Example |
---|---|---|
<Date Object > | Access a date field |
|
<Number of days> | The number of days to be added | 5 |
Examples
The output of the code snippet is a Moment.js date object which you could to:
- Set a Date/Date-time picker field - Eg: Set the Due date to issue created plus 5 days in
- one of the Set Field Value post-functions
- one of the Transition issue post-functions on the transition screen, if any
in the Create issue post-function under Set fields of new issue section
Code Block language js linenumbers true {{ issue.fields.created | dateadd(5,"d") }}
Conditionally execute a post-function or Unlink issues - Eg: Check that the issue has been resolved for more than 10 days
Code Block language js linenumbers true {{ issue.fields.
...
Resolved > now | dateadd(
...
10,"d") }}
Context
The output of this code is a Moment.js date object which you could use:
- To set a Date/Date-time picker field in
- one of the Set Field Value post-functions
- one of the Transition issue post-functions on the transition screen, if any
- in the Create issue post-function under Set fields of new issue section
- To include the Date/Date-time picker in theNotify the customer that the issue will be resolved in 6 days from today through the
- Comment in one of the Comment issue post-functions
Subject/HTML body/Text body of Email issue post-function
Code Block language js linenumbers true Your issue will be resolved on/before {{ now | dateadd(6,"d") }}
Write a JQL search expression
of Linkin the Link issues to current
toissue
In a conditional execution script toRun apost-function
- Unlink issues
Use cases
A typical use case would be to set the Due date of the issue to issue created plus 5 days - Set the due date to issue created plus five days
...
- Eg: Link issues whose "Planned Delivery date" is less than two days
Code Block language js linenumbers true duedate < {{ now | dateadd(2,"d") | date('YYYY-MM-DD') }}
References
...