Formula Expiration

Formula Expiration plugin configuration
Formula Expiration plugin configuration

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

ParameterDescriptionDefault
Expiration formulaAn expression that calculates the expiration date using accrual date components and the makeDate() functionRequired

Formula syntax

Available variables

VariableTypeDescriptionExample
accrual_yearNumberYear of the accrual2025
accrual_monthNumberMonth of the accrual (1-12)3 for March
accrual_dayNumberDay of the accrual (1-31)15

Available functions

FunctionDescriptionExample
makeDate(year, month, day)Creates a date from year, month, and day componentsmakeDate(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:

  1. Add the Formula Expiration plugin to your policy
  2. Set Expiration formula to:
    makeDate(accrual_year + 1, 12, 31)
  3. Click Save

Troubleshooting

IssueSolution
Formula syntax errorCheck that you’re using makeDate() to return a date value
Formula doesn’t saveVerify all parentheses are balanced and operators are correct
Wrong expiration datesTest your formula with sample dates using the variables
Need simpler solutionConsider using Relative Expiration or Period End Expiration instead

Comparison with other plugins

PluginExpiration logic
Relative ExpirationN months after each accrual
Period End ExpirationEnd of fiscal/vacation year + grace period
Never ExpiresTime never expires
Formula ExpirationCustom calculation