Mintage TimeKeeper ·

A time-off engine that does the maths

We built and then rebuilt a time-off policy engine that handles accrual, milestones, carryover, partial months and running balances.

1 min read53 commits that monthTime offPolicies

Policies that follow the rules

June's main piece of work, across 53 commits, was a time-off policy engine. An employer defines a policy, and the engine works out how much time off each person has earned, used and has left.

Policies can now have milestones, so the amount earned can change as someone's length of service grows. Midway through the month we moved carryover hours onto the milestones as well, so the amount someone may carry into a new year can also change with service. Policy settings were moved into a flexible options field so new rules do not need new database columns.

Getting the numbers right

We rewrote the engine as a second version late in the month and spent the following days on correctness. Durations are now stored in minutes, which avoids rounding drift, and shown to people as days and hours. Balances and day counts are rounded consistently.

The engine handles people who join partway through a month, skips accrual when a policy has none, copes with months where nothing accrued, and fixes a miscalculation in the end-of-year deduction. When an employee's hire date changes, their time-off tracker is updated to match.

Tools for administrators

Administrators can record adjustments in minutes and add a description explaining why. Each employee's tracker now shows a running balance, and new endpoints list accrued time off, all time off and deductions. Separately, we added an endpoint that drafts a job description automatically.

This article was written from Mintage TimeKeeper’s commit history for June 2024. See Mintage TimeKeeper today