Formula Expiration

The Formula Expiration plugin calculates expiration dates using a custom formula expression. This provides maximum flexibility for complex expiration rules that don’t fit the standard patterns.
Advanced feature: This plugin requires writing formula expressions. For most use cases, consider using Relative Expiration or Period End Expiration instead.
When to use
Use this plugin when:
- Your expiration rules are too complex for other plugins
- Expiration varies based on when time was accrued (month, season, etc.)
- You need conditional expiration logic
- Standard plugins don’t meet your specific requirements
Parameters
| Parameter | Description | Default |
|---|---|---|
| Expiration formula | An expression that calculates the expiration date using accrual date components and the makeDate() function | Required |
Formula syntax
Available variables
| Variable | Type | Description | Example |
|---|---|---|---|
accrual_year | Number | Year of the accrual | 2025 |
accrual_month | Number | Month of the accrual (1-12) | 3 for March |
accrual_day | Number | Day of the accrual (1-31) | 15 |
Available functions
| Function | Description | Example |
|---|---|---|
makeDate(year, month, day) | Creates a date from year, month, and day components | makeDate(2026, 12, 31) |
Operators
- Arithmetic:
+,-,*,/ - Comparison:
<,<=,>,>=,==,!= - Logical:
&&(and),||(or),!(not) - Conditional:
condition ? value_if_true : value_if_false
Examples
Fixed expiration date
All time expires on December 31, 2026:
makeDate(2026, 12, 31)End of following calendar year
Time expires on December 31 of the year after it was accrued:
makeDate(accrual_year + 1, 12, 31)Different expiration by season
Time accrued in first half of year expires differently than second half:
accrual_month <= 6 ? makeDate(accrual_year + 2, 6, 30) : makeDate(accrual_year + 1, 12, 31)- Accrued Jan-Jun: expires June 30, two years later
- Accrued Jul-Dec: expires December 31, one year later
Quarter-end expiration
Time expires at the end of the quarter, one year after accrual:
accrual_month <= 3 ? makeDate(accrual_year + 1, 3, 31) :
accrual_month <= 6 ? makeDate(accrual_year + 1, 6, 30) :
accrual_month <= 9 ? makeDate(accrual_year + 1, 9, 30) :
makeDate(accrual_year + 1, 12, 31)Setup example
To expire time at the end of the following year:
- Add the Formula Expiration plugin to your policy
- Set Expiration formula
to:
makeDate(accrual_year + 1, 12, 31) - Click Save
Troubleshooting
| Issue | Solution |
|---|---|
| Formula syntax error | Check that you’re using makeDate() to return a date value |
| Formula doesn’t save | Verify all parentheses are balanced and operators are correct |
| Wrong expiration dates | Test your formula with sample dates using the variables |
| Need simpler solution | Consider using Relative Expiration or Period End Expiration instead |
Comparison with other plugins
| Plugin | Expiration logic |
|---|---|
| Relative Expiration | N months after each accrual |
| Period End Expiration | End of fiscal/vacation year + grace period |
| Never Expires | Time never expires |
| Formula Expiration | Custom calculation |