Date calculations
Find out how to calculate a date or a batch of dates in your Next Matter workflow.
Good to know: Check out our ready-made templates available when you add a step and select Templates > Next Matter templates. You can use the templates to create a set of pre-configured steps.
- Open your workflow and create a form step with the two form fields. Click + Add form field and create the following:
- Date Input: The date when you want to apply the calculation. This will be form field one.
- Text Input - Short: This is to submit the days that you want to add/subtract when running your workflow. This will be form field two.
Note: To subtract days, enter a negative number such as -5. For adding days simply type the number.
- Now create the date calculation step. To do that, create an integration step after step 1.
- Click Settings to configure the step. Enter the following details:
- Method: POST
- URL:
https://integrations.nextmatter.com/g/utils/calculatedate
- Headers: Content-Type: application/json
- Body might look like the following:
Single date example
{
"date": "<DATE>",
"days_to_add": "<NUMBER OF DAYS>",
"enable_business_days": <TRUE or FALSE>
}
date: Enter the date by using the data reference of the date form field from the previous step.
days_to_add: Number of days to add or remove. To remove, add a minus, for example, -5
enable_business_days: Optional. If set to true, the calculation skips Saturday and Sunday. Adding 1 day to a Friday leads to the next Monday. This feature is not available when removing dates. It will return an error if days_to_add is negative, and enable_business_days is set to true.
For example:
{
"date": "2022-07-01",
"days_to_add": 1,
"enable_business_days": true
}
In reality, Body might look like the following:
{
"date": "{1. Enter Date Info - Choose initial date - Date}";
"days_to_add": [1.. Enter Date Info - Choose days to add. Use a minus if you want to substract days. - Input)
}
Batch of single dates example
Your batch might look like the following:
[
{
"date": "2022-05-01",
"days_to_add": 1,
"enable_business_days": true
},
{
"date": "2022-06-01",
"days_to_add": -5,
"enable_business_days": false
},
{
"date": "2022-06-01",
"days_to_add": 2
}
]
-
In the Results to be used in later steps, click Add variable.
You need to create a variable for every date set so that the resulting date can be referenced in later steps.
- For one date set, add the
calculatedDate
variable with the value of$.date
- For multiple sets, your variables might be the following:
Name Value calculatedDate1 $[0].date calculatedDate2 $[1].date calculatedDate2 $[2].date - For one date set, add the
Updated 29 days ago