Select Page

How About a Date with InRule?

by | Last updated on Mar 26, 2024

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 d ate 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.

Scenario #1

NEED TO KNOW #1

The IsBetween function is inclusive and does not differentiate which date comes first, the Effective Date or the Expiration Date.

Scenario #2

NEED TO KNOW #2

A null or empty date will resolve to 1/2/0001 for the purpose of date comparison.

Scenario #3

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.

BLOG POSTS BY TOPIC:

FEATURED ARTICLES:

STAY UPDATED ON THE LATEST FROM INRULE

We'd love to send you monthly updates! Learn about our webinars and newly published content by subscribing to our emails. We'll never share your email address and you can easily unsubscribe at any time.