Modeling PTO Accrual in Code: Pay-Period Drift, 27-Paycheck Years, and Caps

2026-11-16来源 dev.toEnglish

A company policy that states "120 hours of paid time off per year" produces three distinct balance curves depending on whether leave is granted per biweekly paycheck, per semi-monthly paycheck, or per hour worked.

Three Accrual Schedules in Exact Fractions

  • Biweekly (26 paychecks): 120 / 26 = 4.61538... hours per paycheck. Store accrued time in integer minutes or fixed-point thousandths of an hour (4615 or rational 60/13), not 2-decimal floats (4.62 * 26 = 120.12 hours drift).
  • Semi-monthly (24 paychecks): 120 / 24 = 5.00 hours per paycheck, zero rounding drift.
  • Hours worked (2,080 baseline): 120 / 2080 = 3 / 52 ≈ 0.05769 hours of PTO per regular hour worked.

The 27-Paycheck Year and Bank Cap Edge Cases

Every ~11 years, a biweekly calendar contains 27 pay dates instead of 26. Without an annual or balance cap check (min(cap, balance + accrual)), an unguarded payroll loop awards 27 * 4.6154 = 124.62 hours. Conversely, once balance == cap, accruals silently clamp to zero until the employee uses leave.

To model per-period accruals, planned time off, and cap headroom step by step, you can run numbers through the Miryori PTO Calculator.

Related reading

YMYL note: calculations illustrate standard accrual math only; company handbooks and state payout laws govern actual leave balances.

原文:https://www.a8q9.cn/en/article/modeling-pto-accrual-in-code-pay-period-drift-27-paycheck-years-and-caps-651c5f.html

相关文章