Every one faces leap year issue

During an project in Insurance domain, I faced a weird problem in the month of February. In our system every day the application runs a premium due date job which creates a list of insurance premium account with current premium value, to debit it from customer’s account.

On the last date of February the application did not create any file, So every year there was a manual run on the next day. Once the incident was given to us we checked the logic. There was a check on the last day and if it was last day there was check for 30th and 31st based on which further calculation was done. Thus every time it misses 28th and 29th of Feb.

I just made a simple change of passing the last date value to the function. So if its a last day. It passes 28, 29, 30 or 31 to the function. Thus reducing the line of code and working for all last dates. The learning here is  once must always take care of Feb when working some calculation with last day of the month.

Advertisements