How About a Date with InRule?
A date gone bad can be a funny thing – it can be the source of a story for the ages or a memorable movie bit. But a bad date check in business logic…not so funny, and more than likely it will not result in a “bank error in your favor.”
Consider the following date expression:
This seemingly innocuous date expression represents a number of considerations for a rule author who is handling date logic. The following series of test scenarios based on the above expression help demonstrate a few of the more notable considerations.
NEED TO KNOW #1
The IsBetween function is inclusive and does not differentiate which date comes first, the Effective Date or the Expiration Date.
NEED TO KNOW #2
A null or empty date will resolve to 1/2/0001 for the purpose of date comparison.
NEED TO KNOW #3
Be aware of date times that could influence date checking. In the above scenario if the dates being checked were actually DateTime fields (which occurs more than you might think), the time could throw off the date check.
How to handle these scenarios so your date doesn’t go south?
Vocabulary to the rescue, of course! The below “is within contract dates” custom vocabulary is an example of a template that can be employed to mitigate the unexpected behaviors described in the preceding test scenarios.
Moving on down the road, relying on this or similar custom vocabulary templates should help ensure that your dates with InRule go silky smooth.