You now are able to perform date calculations in a very simple way.
Very useful if you want to create booking forms and calculate prices based on time units (EG. days).
Forms has a special feature that would let you calculate the age using the date of birth quickly.
To get started, we are going to create a Form with a Date field (Label: Date of Birth), a Number field (Age), and a Submit button. Your form should look like this screenshot:
Now go to the Rule Builder (Forms > Actions > Conditional rules) and click “Add rule”.
1. Name: Calculate Age From Date Of Birth
2. Click “Add condition” > Date of Birth is present
3. Click “Add action” > Evaluate
5. Formula: differenceInYears(now(), {{date_1}})
6. Set Result to Field: Age.
Do you need to calculate the number of days between two dates? Now this is something that is very easy and pleasant to do.
To get started, we are going to create a Form with two date fields (Check In and Check Out), a number field (Number of days) and a submit button. Your form should looks like this screenshot:
Now go to the Rule Builder (Forms > Actions > Conditional rules) and click “Add rule”.
1. Name: Calculate days between dates
2. Click “Add condition” > Check In is present
3. Click “Add condition” > Check Out is present
4. Click “Add action” > Evaluate
5. Formula: differenceInDays({{date_2}}, {{date_1}})
6. Set Result to Field: Number of Days.
Your Rule should looks like this screenshot:
Note: To calculate the difference we set the Check Out field before the Check In field.