Workday bucketing, stage 2 of the pipeline

Featurekamo-shared-library
Shipped
August 12, 2026 at 12:09 AM UTC
Author
Kamo
Commit
c00cbba

Resolved intervals become per-business-date seconds, ready for the allocator. An interval is SPLIT at every workday boundary it crosses: a 22:00-06:00 shift under a midnight workday is 2 hours on one date and 6 on the next. Attributing the whole span to its start date makes daily overtime and the seventh-day rule wrong for every night worker. This is deliberately a DIFFERENT attribution from the businessDate persisted on the punch. The punch carries one date -- for meal/rest evaluation, the exception queue and what the employee sees as their shift -- while overtime counting needs hours apportioned across the workdays and workweeks they actually fell in. Both are correct, both are needed, and conflating them is the trap. A shift crossing the WORKWEEK boundary likewise contributes to two weeks' overtime totals; counting all of it in either one is wrong for both. Accumulates in seconds throughout. Tests cover both DST transitions, a 50-hour span, and punches end-to-end through allocation for a California week.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing