Time Card Calculator: Quick Framework
1. Core Data Model
- Row: date, start, end, break(min), notes.
- Derived: shiftHours = (end−start ± midnight) − break/60.
2. Weekly Aggregation
- Total = Σ shiftHours (visible rows).
- Regular = min(total, threshold).
- OT = max(0, total − threshold) × multiplier.
3. Flow
- User edits row → recompute that row.
- Rebuild weekly sums + pay.
- Persist (localStorage) on demand.
- Generate printable snapshot (freeze numbers).
4. Sanity Checks
- End <= start → assume overnight (add 24h).
- Break not exceeding raw span.
- Negative hours clamp to 0.
5. Shortcuts
- Copy first row to propagate schedule.
- Export pay columns directly for payroll import.
- Round only at display (store precise decimals).
6. Pitfalls
- Double overtime when both daily & weekly rules apply (implement precedence if needed).
- Forgot daylight saving shift on transition Sundays.
- Hidden rows still counted (exclude by visibility).
7. Micro Examples
Mon 09:00–17:30 break 30 → 8.0h
Weekly 44h threshold 40 → OT=4
OT pay @1.5: 40 + 4×1.5 = 46 pay‑hours
8. Mini FAQ
- Daily OT? Add second pass per row if required.
- Half-day? Just shorter end; no special flag.
- Missed punch? Leave blank → 0; highlight for review.
9. Action Tip
Keep a canonical numeric hours array; every export/view regenerates from it ensuring consistency.