How to use operators in date variables?
Background
The date variables in ARN templates like [releaseDate], [sprintStartdate], [sprintEnddate], etc are replaced by their actual values (date) as fetched from Jira. However, there are ample use cases where users want to manipulate this date on the go and then use the calculated value in the ARN template.
For example, what if I want to include the number of days remaining for release or a date that is 15 days prior to the version release date which is basically our QA release date? In such a scenario system allows me to use some operators with the date type variables and display the calculated date in release notes.
Here is an example of how the value of [releaseDate] variable can be used with different operators.
Syntax
The syntax used to indicate the use of an operator in the date variable would be as follows
Date variable without any operator | Date variable with operator |
---|---|
[dateVariable] | [dateVariable|operatorName] |
This will be replaced by actual date returned from Jira. | This will be replaced by the returned value after the calculations done based on the selected operator. |
Operators
Below table explains the type of operators we support with some simple examples that will help you to understand how you can use these operators along with the date type variables.
Operator | Syntax | Calculations |
---|---|---|
Remaining days | [dateVariable|remainingDays] |
|
Elapsed days | [dateVariable|elapsedDays] |
|
Add/Subtract days | [dateVariable|+Number of days] [dateVariable|-Number of days] |
|
Add/Subtract months | [dateVariable|+Number of months] [dateVariable|-Number of months] |
|
Add/Subtract years | [dateVariable|+Number of years] [dateVariable|-Number of years] |
|
Extract date | [dateVariable|dd] |
|
Extract month | [dateVariable|mm] [dateVariable|mmm] [dateVariable|mmmm] |
|
Extract year | [dateVariable|yy] [dateVariable|yyyy] |
|
Applicable variables
Above operators will support only ARN date variables listed below -
startDate
releaseDate
sprintStartdate
sprintEnddate
sprintCompleteddate
currentDate
currentDatetime
timeStamp
Use cases
Below are some use cases that might help you to get an idea on how to use these operators.
To convey remaining days between current date and release date
To calculate and display elapsed days from the planned release that has already passed
Subtract number of days from the planned release date/sprint end date to notify the deadline to complete certain action/step in the process. Eg. QA release should happen before 15 days of the Product release then, subtract 15 days from release date and display QA release date.
On this page |
---|