Solved
Using rules engine to correctly account for leap years
I currently have a rule built out that looks at a certain date field (we'll call it Date XYZ) and when the current date (rule date) is 365 days ahead of "Date XYZ", it triggers the setup action. Within the Setup Rule, the only way to determine if a certain date is exactly 1 year in the past is through the "Subtract N Days from Rule Date". This works fine with N = 365 except for leap years where N needs to equal 366. Doing a simple OR statement won't give me the correct results for when the year is a non-leap year. Anyone have any experience working with year anniversary based setup actions accounting for leap years?
Best answer by dan_ahrens
Hi Shane,
It sounds like you need to look for the exact calendar day of the month, right? So on June 26, 2019 you'd trigger a rule action for a customer who signed on June 26, 2018. Is this right?
What's the action you're triggering and what's the impact if it's one day off?
A simplistic way to solve for this would be to change the N=365 to N=366 on February 29 and then change it back on Feb 28 the following year. 😉
It sounds like you need to look for the exact calendar day of the month, right? So on June 26, 2019 you'd trigger a rule action for a customer who signed on June 26, 2018. Is this right?
What's the action you're triggering and what's the impact if it's one day off?
A simplistic way to solve for this would be to change the N=365 to N=366 on February 29 and then change it back on Feb 28 the following year. 😉
Sign up
If you ever had a profile with us, there's no need to create another one.
Don't worry if your email address has since changed, or you can't remember your login, just let us know at community@gainsight.com and we'll help you get started from where you left.
Else, please continue with the registration below.
Welcome to the Gainsight Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.