Overtime math: test cases
The prototype's engine is js/engine.js. Run the tests from this folder with node tests/engine.test.js. The result on 2026-10-26 was 45 of 45 passed, including a property test of 10,000 random weeks (each priced through both input paths) and 2,000 random week totals against an exact reference, with 0 cent errors. The same cases are pressed through the live pages in Playwright (qa/press-overtime.js, qa/press-timecard.js); outputs are in ../design/review/verify/.
Each case is one workweek at a single hourly rate, with no bonuses or shift differentials.
How the engine keeps money exact (changed 2026-10-26, review B12)
- Time is held as whole ticks: 1 hour = 360,000 ticks, so a minute (6,000 ticks) and a typed hour to four decimals (36 ticks per 0.0001 hour) are both exact. Clock times go in as whole minutes (
splitWeekMinutes).
- A rate is held in ten-thousandths of a dollar, so $15.99 and $20.555 are exact.
- Hours are never rounded before pay. Each pay line is ticks x rate x multiplier, divided once and rounded half up to the cent. The total is the sum of the rounded lines, so the ledger always adds up.
- The old engine rounded hours to 4 decimals first, which put 2,734 of 20,000 random weeks one cent out (for example $695.56 instead of $695.57).
- The reference in the property test is written separately: it walks the week one minute at a time and prices each line with BigInt rationals.
Rules applied
| Rule |
What the engine does |
Source |
| Federal (FLSA) |
1.5x the regular rate for hours over 40 in a workweek. No daily overtime and no double time. |
29 U.S.C. 207(a)(1); DOL WHD, Overtime Pay, https://www.dol.gov/agencies/whd/overtime |
| Federal workweek |
A fixed, recurring 168-hour period. Each workweek is counted on its own, with no averaging across two weeks. |
29 CFR 778.104, 778.105, https://www.ecfr.gov/current/title-29/subtitle-B/chapter-V/subchapter-B/part-778 |
| California daily |
1.5x for hours over 8 in a workday, up to 12. 2x for hours over 12 in a workday. |
Cal. Labor Code 510(a); California Labor Commissioner, Overtime FAQ, https://www.dir.ca.gov/dlse/faq_overtime.htm |
| California weekly |
1.5x for hours over 40 in the workweek. Only straight-time hours count toward the 40, so no hour is paid twice. |
Cal. Labor Code 510(a); Overtime FAQ (as above) |
| California 7th day |
When all 7 days of the workweek are worked, the 7th day pays 1.5x for its first 8 hours and 2x after that. |
Cal. Labor Code 510(a); Overtime FAQ (as above) |
| Alaska (supporting case only) |
1.5x over 8 hours a day or 40 a week, never counted twice; employers with 4 or more employees. |
Alaska Stat. 23.10.060; https://labor.alaska.gov/lss/whfaq.htm |
The six cases
| # |
Rules |
Hours (Mon to Sun) |
Rate |
Regular |
Overtime 1.5x |
Double time 2x |
Pay for the week |
Working |
| T1 |
Federal |
45 (week total) |
$20.00 |
40 |
5 |
0 |
$950.00 |
40 x $20.00 = $800.00; 5 x $30.00 = $150.00 |
| T2 |
Federal |
38 (week total) |
$18.50 |
38 |
0 |
0 |
$703.00 |
38 x $18.50 = $703.00; under 40, so no overtime |
| T3 |
California |
10, 10, 10, 10, 6, 0, 0 |
$20.00 |
38 |
8 |
0 |
$1,000.00 |
Four days over 8 give 2 h each = 8 h daily overtime. Straight-time hours are 38, under 40, so no weekly overtime. 38 x $20.00 = $760.00; 8 x $30.00 = $240.00. The same week under federal rules is 40 + 6 = $980.00 (T3b) |
| T4 |
California |
14, 8, 8, 8, 8, 0, 0 |
$20.00 |
40 |
4 |
2 |
$1,000.00 |
Monday: 8 regular, hours 9 to 12 at 1.5x (4 h), hours 13 and 14 at 2x (2 h). 40 x $20.00 = $800.00; 4 x $30.00 = $120.00; 2 x $40.00 = $80.00 |
| T5 |
California |
8, 8, 8, 8, 8, 8, 10 |
$20.00 |
40 |
16 |
2 |
$1,360.00 |
Days 1 to 6 give 48 straight-time hours, so 8 are weekly overtime. Day 7 (all 7 days worked): first 8 h at 1.5x, 2 h at 2x. 40 x $20.00 = $800.00; 16 x $30.00 = $480.00; 2 x $40.00 = $80.00. Federal rules on the same week: 40 + 18 = $1,340.00 (T5c) |
| T6 |
California |
9, 9, 9, 9, 9, 9, 0 |
$25.00 |
40 |
14 |
0 |
$1,525.00 |
Six days, so no 7th-day rule. 6 h daily overtime; straight-time hours are 48, so 8 more are weekly overtime. 40 x $25.00 = $1,000.00; 14 x $37.50 = $525.00 |
Checked through the page (press-everything pass)
| Case |
Where |
Result shown |
| T1 |
Overtime calculator, example values |
$950.00 |
| T3 and T3b |
Overtime calculator, day by day, California then Federal |
$1,000.00 and $980.00 |
| T4 |
Overtime calculator, day by day, California |
$1,000.00, Monday "8 reg + 4 OT + 2 2x" |
| T5 |
Overtime calculator, day by day, California |
$1,360.00 with the 7th-day note |
| Full week |
Time card, California, 6:00 AM to 7:00 PM x 7, 30-minute breaks on 5 days, $25.00 |
88:30 total, 40:00 regular, 40:00 overtime, 8:30 double time, $2,925.00 |
| Overflow |
Overtime calculator, 168 h at $9,999.99 |
$2,319,997.68, fits the result panel |
Added 2026-10-26
| Case |
Source |
Result |
| W1 |
29 CFR 778.110(a): $12 an hour, 46 hours |
$552 + $36 = $588.00 |
| W2 |
Cal. Labor Code 510(a): 13 h x 4 days at $20 |
640 + 480 + 160 = $1,280.00 |
| W3 |
Alaska Stat. 23.10.060: 13 h x 4 days at $20 |
640 + 600 = $1,240.00 |
| B12 |
Federal, minutes 570, 0, 581, 534, 314, 0, 541 at $15.99 |
$695.57 |
| B13 |
California, 12.25 h at $17.33 |
138.64 + 103.98 (4 h x $25.995) + 8.67 = $251.29 |
| Overflow |
California, 23:59 x 7 at $9,999.99 |
$2,757,663.91 |
Not covered yet
- The regular rate when bonuses or shift differentials apply (29 CFR 778.207(b)). The calculator takes one hourly rate.
- Alternative workweek schedules in California, and the exemptions under Labor Code 514 and 515.
- A workweek that does not start on Monday: the day rows can be read as day 1 to day 7, but the labels say Monday to Sunday.
- Rounding of clock times (29 CFR 785.48). The time card counts exact minutes.
Not legal, tax or payroll advice.
Group A (time entry): test cases
Engines: js/engines/hours-worked-calculator.js, time-clock-calculator.js, biweekly-time-card-calculator.js, timesheet.js. Run from prototype/:
node tests/hours-worked-calculator.test.js # 22 cases
node tests/time-clock-calculator.test.js # 18 cases
node tests/biweekly-time-card-calculator.test.js # 16 cases
node tests/biweekly-time-card-calculator.property.test.js # 10,000 random workweeks, 0 mismatches
node tests/timesheet.test.js # 9 cases
Result on October 26, 2026: 65 of 65 cases passed, and the property test had 0 mismatches in 10,000 workweeks. When the property test was run against the current shared engine.js pay(), it found 360 one-cent mismatches, which confirms the shared rounding bug and that the test catches it.
Rules applied (each source opened on October 26, 2026 through the eCFR API)
| Rule |
What the engine does |
Source |
| Each workweek stands alone |
Overtime is counted for each workweek separately. Two weeks are never averaged. |
29 CFR 778.104 |
| Workweek |
A fixed 168-hour period that can start on any day. The tool assumes it starts at 12:00 AM, so an overnight shift on the last day of a workweek is split at midnight. |
29 CFR 778.105 |
| Rest and meal breaks |
Only the unpaid break the user enters is taken off. Rest breaks of 5 to about 20 minutes are hours worked. A bona fide meal period, usually 30 minutes or more, is not. |
29 CFR 785.18, 785.19 |
| Time clock rounding |
Each punch may be rounded to the nearest 5 minutes, tenth (6 min) or quarter (15 min) of an hour. The rule accepts this only if it does not, over time, leave employees unpaid. The regulation sets no tie rule; the engine sends a tie (3 minutes on a 6-minute step) to the later time (E). |
29 CFR 785.48(b) |
| Records |
Hours worked each workday and each workweek, and the workweek start. Time cards are kept at least 2 years, and payroll records at least 3. |
29 CFR 516.2(a), 516.5, 516.6 |
| Pay |
Integer cents. Each line is minutes x rate in cents x multiplier / 60, rounded half up once. Each week is paid on its own lines, then the weeks are added. |
Lead's instruction, October 26, 2026 |
H. Hours worked
| # |
Input |
Working |
Result |
| H1 |
9:00 AM to 5:00 PM, no break |
17:00 - 9:00 |
8:00, 8.00 |
| H2 |
8:45 AM to 5:15 PM, 30 min |
8:30 - 0:30 |
8:00 |
| H3 |
11:00 PM to 7:00 AM |
7:00 + 24:00 - 23:00 |
8:00, overnight |
| H4 |
H2 + 7:00 AM to 1:45 PM (30 min) + 5:10 PM to 10:00 PM |
480 + 375 + 290 = 1,145 min |
19:05, 19.08 |
| H6 |
12:00 AM to 12:00 PM; 12:00 PM to 12:00 AM |
0:00 to 12:00; 12:00 to 24:00 |
12:00 each |
| F1 |
Start 8:00 AM, 8 h, 30 min break |
8:00 + 8:30 |
4:30 PM |
| F2 |
Start 10:00 PM, 8 h, 30 min break |
22:00 + 8:30 = 30:30 |
6:30 AM, next day |
C. Time clock
| # |
Punch, step |
Working |
Result |
| C1, C2 |
8:07 and 8:08, quarter hour |
7 < 7.5 rounds down; 8 > 7.5 rounds up |
8:00, 8:15 |
| C4 to C6 |
8:02, 8:04, 8:03 on 6 minutes |
2 < 3 down; 4 > 3 up; 3 = 3 tie, later time |
8:00, 8:06, 8:06 |
| C7, C8 |
8:02, 8:03 on 5 minutes |
2 < 2.5 down; 3 > 2.5 up |
8:00, 8:05 |
| C10 |
7:53 to 4:07 PM, quarter hour |
8:00 to 16:00 |
8:00 (exact 8:14, -0:14) |
| C11 |
10:04 PM to 6:10 AM, quarter hour |
22:00 to 6:15 |
8:15 (exact 8:06) |
| C12 |
11:50 PM to 11:58 PM, quarter hour |
23:45 to 24:00 |
0:15 |
| C13 |
8:00 to 8:05, quarter hour |
both round to 8:00 |
0:00 (exact 0:05) |
| C15 |
Mon 7:53-12:02, 12:33-4:07; Tue 8:06-12:00, 12:28-4:12 |
exact 4:09 + 3:34 + 3:54 + 3:44; rounded 4:00 + 3:30 + 4:00 + 3:45 |
exact 15:21, rounded 15:15, -0:06 |
| C17 |
5 x 7:58 AM to 6:05 PM, quarter hour |
5 x 10:00 = 50:00 |
40:00 regular, 10:00 overtime |
B. Biweekly
| # |
Weeks, rule, rate |
Working |
Pay |
| B1 |
30 h + 50 h, federal, $20.00 (the 778.104 example) |
70 x $20.00 = $1,400.00; 10 x $30.00 = $300.00 |
$1,700.00 (averaging would give $1,600.00) |
| B2 |
40 + 40 |
no overtime |
$1,600.00 |
| B3 |
45 + 45 |
2 x (40 x $20.00 + 5 x $30.00) |
$1,900.00 |
| B4 |
California, week 1 10/10/10/10/6, week 2 5 x 8 |
week 1: 38 reg + 8 daily OT |
$1,800.00 |
| B5 |
Week 1 last day 10:00 PM to 6:00 AM, 30 min |
2:00 before midnight - 0:30 = 1:30 in week 1; 6:00 in week 2 |
split |
| B6 |
Week 2 last day 8:00 PM to 4:00 AM |
4:00 kept, 4:00 belongs to the next period |
spill note |
| B8 |
11:45 PM to 8:00 AM, 30 min |
0:15 before midnight, break takes it and 0:15 more |
0:00 / 7:45 |
| B10 |
14 x 16 h at $9,999.99 |
each week 40 reg + 72 OT: $399,999.60 + $1,079,998.92 |
$2,959,997.04 |
S. Timesheet
| # |
Input |
Result |
| S1 |
The time card page's example week, $18.50 |
41:30, 40 regular, 1:30 overtime, $781.63 (90 OT min x 1,850 c x 3 / 120 = 4,162.5 c, half up 4,163 c); same as the time card page |
| S2 |
Same week 1, empty week 2 |
overtime 1:30 stays in week 1 |
| S4 |
Name "=SUM(A1)" in the CSV |
written as text, '=SUM(A1) |
Not covered
- Daylight saving nights (November 1, 2026): a 10 PM to 6 AM shift is 9 elapsed hours that night. The tools count clock times, so they show 8. Not on the pages yet.
- Workweeks that start at an hour other than 12:00 AM.
- A monthly timesheet (backlog P2-4 lists weekly, biweekly and monthly; weekly and biweekly are built).
- Rounding of seconds; punches are whole minutes.
The engines are pure modules in js/engines/. Run the tests from prototype/ with node tests/<page>.test.js. On October 26, 2026 the results were: decimal hours 30 of 30, hours calculator 24 of 24, time duration 19 of 19, military time 26 of 26. The same cases were also pressed through the live pages with qa/press-<page>.mjs, which reported 113, 136, 105 and 107 checks passed.
Every case below was worked out by hand before the code ran.
Rules applied
| Rule |
What the engine does |
Source |
| Minutes to decimal |
Decimal hours = hours + minutes / 60 (+ seconds / 3,600). The result is shown to 2 places, rounded half-up, with the exact value to 4 places. |
Arithmetic |
| Decimal to minutes |
Minutes = decimal part x 60, rounded half-up to the nearest whole minute. |
Arithmetic |
| Clock difference |
End minus start; if the end is earlier, add 24:00 first. No breaks are taken out. |
Arithmetic |
| Add and subtract |
Each line becomes minutes (decimal hours and minutes over 59 allowed), lines are summed with their sign, and the total is rounded to the whole minute once at the end. |
Arithmetic |
| Date-time duration |
The end moment minus the start moment in the device's time zone, so a daylight saving change between them is counted. The plain clock difference is shown as well. |
15 U.S.C. 260a (DST starts 2 a.m. on the second Sunday of March and ends 2 a.m. on the first Sunday of November); NIST, Daylight Saving Time (Arizona, Hawaii, Puerto Rico, Guam, USVI and American Samoa do not observe it) |
| Military time |
Hours 00 to 23. 13 to 23: subtract 12, PM. 00 = 12 AM, 12 = 12 PM. 2400 is accepted as the end of a day (= 0000 the next day). |
Arithmetic |
| Time clock rounding (page text only) |
Rounding punches to the nearest 5 minutes, tenth or quarter hour is accepted only if it does not underpay over time. |
29 CFR 785.48(b) |
D: decimal hours
| # |
Input |
Working |
Expected |
| D1 |
0:15 |
15 / 60 = 0.25 |
0.25 |
| D2 |
0:30 |
30 / 60 = 0.5 |
0.50 |
| D3 |
0:45 |
45 / 60 = 0.75 |
0.75 |
| D4 |
0:07 |
7 / 60 = 0.11666... |
0.1167 (4 places), 0.12 (2 places) |
| D5 |
8:20 |
8 + 20 / 60 = 8.3333... |
8.33 |
| D6 |
7.75 h back |
0.75 x 60 = 45 |
7:45 |
| D7 |
0:40 |
0.6666... rounds up |
0.67 |
| D8 |
0:01 |
0.01666... |
0.02 / 0.0167 |
| D9 |
0:03 |
exactly 0.05 |
0.05 |
| D11 |
8.33 h back |
0.33 x 60 = 19.8, rounds to 20 |
8:20 |
| D12 |
0.1 h back |
0.1 x 60 = 6 |
0:06 |
| D13 |
1:30:30 |
1 + 0.5 + 30 / 3,600 = 1.50833 |
1.5083 |
| P1 |
6:50, 9:35, 16:25 |
6.8333, 9.5833, 16.4167 |
6.83, 9.58, 16.42 |
| P2 |
6.83 + 9.58 |
rounded days added |
16.41 (0.01 short of converting the total: the page's worked example) |
| C1 to C5 |
chart 0 to 59 |
each row = toDecimal(0, m); the static HTML table is read back and compared row by row |
60 rows match |
| Edges |
0:00; 1:60; -1 h; 9999:59; 59.9999 h back; 1.005 to 2 places |
|
0.00; refused; refused; 9,999.98; 60:00; 1.01 |
H: hours calculator
| # |
Input |
Working |
Expected |
| H1 |
9 AM to 5 PM |
17:00 - 9:00 |
8:00 |
| H2 |
2:45 + 3:30 |
165 + 210 = 375 min |
6:15 |
| H3 |
1:10 - 2:20 |
70 - 140 = -70 min |
-1:10 |
| H4 |
10 PM to 2 AM |
(2:00 + 24:00) - 22:00 |
4:00, overnight |
| H5 |
8:15 AM to 4:45 PM |
16:45 - 8:15 = 8:30 |
8:30 = 8.50 h |
| H6 |
7:50 AM to 3:20 PM |
borrow: 14:80 - 7:50 |
7:30 |
| H7 |
1 h 90 min |
60 + 90 = 150 min |
2:30 |
| H8 |
1.5 h + 0:45 |
90 + 45 = 135 min |
2:15 |
| H9 |
26:30 |
1,590 min |
1 day 2 h 30 min |
| P1 |
11 PM to 7:30 AM |
(7:30 + 24:00) - 23:00 |
8:30 |
| P2 |
4:20 + 2:55 |
260 + 175 = 435 min |
7:15 = 7.25 h |
| P3 |
0:45 - 2:00 |
45 - 120 = -75 min |
-1:15 = -1.25 h |
| P4 |
1:50 + 2:25; 3:40 + 1:35 |
255 min; 315 min |
4:15; 5:15 |
| Edges |
same time; 12 AM to 12 PM; 11:59 PM to 12 AM; no lines; -2 h; 99,999:59; 1.33 h |
|
0:00 flagged; 12:00; 0:01; 0; refused; 99999:59; 1:20 (79.8 min rounds once) |
T: time duration
| # |
Zone |
From |
To |
Working |
Expected |
| T1 |
America/New_York |
Nov 1, 2026 12:00 AM |
Nov 1, 2026 4:00 AM |
clocks go back at 2:00, the 1:00 hour repeats |
5 h elapsed, 4 h on the clock |
| T2 |
America/New_York |
Mar 14, 2027 12:00 AM |
Mar 14, 2027 4:00 AM |
clocks jump 2:00 to 3:00 |
3 h elapsed |
| T3 |
any |
Feb 28, 2028 |
Mar 1, 2028 |
2028 has Feb 29 |
2 days |
| T3b |
any |
Feb 28, 2027 |
Mar 1, 2027 |
no Feb 29 |
1 day |
| T5 |
any |
Oct 26, 2026 10:00 PM |
Oct 27, 2026 6:30 AM |
2:00 + 6:30 |
8 h 30 min |
| T6 |
any |
Jan 5, 2026 8:00 AM |
Jan 9, 2026 5:00 PM |
4 days + 9 h |
105 h |
| T7 |
any |
Oct 27 9:00 AM |
Oct 26 9:00 AM |
end before start |
-24 h, negative flag |
| T8 |
America/New_York |
Mar 14, 2027 2:30 AM |
|
that clock time never happens |
flagged as skipped |
| T9 |
any |
Jan 1, 2026 |
Jan 1, 2126 |
100 x 365 + 24 leap days (2100 is not a leap year) |
36,524 days |
| T10 |
America/New_York |
Mar 1, 2026 |
Nov 30, 2026 |
both changes cancel |
DST shift 0 |
| T11 |
America/Phoenix |
Nov 1, 2026 12:00 AM |
4:00 AM |
no DST |
4 h |
| T12 |
Pacific/Honolulu |
Mar 14, 2027 12:00 AM |
4:00 AM |
no DST |
4 h |
| T14 |
any |
Tue Oct 27 6:00 PM |
Thu Oct 29 7:30 AM |
1 day + 13:30 |
37.5 h |
| Edges |
|
Feb 30; empty; Feb 29, 2028; Feb 29, 2100 |
|
|
refused; empty; valid; refused |
M: military time
| # |
Input |
Working |
Expected |
| M1 |
1300 |
13 - 12 = 1, PM |
1:00 PM |
| M2 |
0000 |
00 is midnight |
12:00 AM |
| M3 |
1200 |
12 stays, noon |
12:00 PM |
| M4 |
2359 |
23 - 12 = 11 |
11:59 PM |
| M5 |
2400 |
end of day |
12:00 AM, end-of-day flag |
| M6 |
1545 |
15 - 12 = 3 |
3:45 PM |
| M7 |
0930, 930, 09:30 |
|
9:30 AM each |
| M8 |
3:00 PM |
3 + 12 |
1500 |
| M9 |
12 AM; 12 PM |
|
0000; 1200 |
| M10 |
11:59 PM |
11 + 12 |
2359 |
| M11 |
12:30 AM |
|
0030 |
| M12 |
said as |
1300, 0930, 0000, 0005, 2145, 0100 |
thirteen hundred; zero nine thirty; zero hundred; zero zero zero five; twenty-one forty-five; zero one hundred |
| M13 |
every minute of the day |
24h to 12h and back |
1,440 of 1,440 round trip |
| M14 |
2115; 1945 |
|
9:15 PM; 7:45 PM |
| C1 to C4 |
chart |
24 rows from the same functions; the static HTML table is read back and compared |
24 rows match |
| Edges |
2500; 1260; 2401; "1pm"; blank; "13"; "1300 hours"; 13 PM |
|
refused; refused; refused; refused; empty; 1:00 PM; 1:00 PM; refused |
Not covered
- A time that happens twice on the night clocks go back (1:00 to 1:59 AM): the browser picks the first one, and the page says so. There is no control to choose the second.
- Time zones other than the device's own. The page names the zone it used.
- Seconds in the hours calculator and time duration calculator. Both work to the minute.
Not legal, tax or payroll advice.
Engines: js/engines/time-and-a-half-calculator.js, double-time-calculator.js, shift-differential-calculator.js, payroll-hours-calculator.js. Run from prototype/:
node tests/time-and-a-half-calculator.test.js # 32 of 32
node tests/double-time-calculator.test.js # 19 of 19
node tests/shift-differential-calculator.test.js # 20 of 20
node tests/payroll-hours-calculator.test.js # 30 of 30
Result on October 26, 2026: 101 of 101 passed. Each file also runs a property test of 10,000 seeded random cases (seed 20261026) against exact BigInt arithmetic in hundredths of an hour and cents, with zero mismatches allowed.
How money is rounded
Hours are carried as whole units of 1/300 hour (12 seconds), which is exact for two-decimal hours and for whole minutes. Rates are carried as whole 1/10,000 dollars. Each pay line (regular, 1.5x, 2x, differential, overtime premium) is one integer division rounded half-up to the cent. Nothing is rounded before that, and the total is the sum of the lines. Rates shown on screen are rounded for display only; a rate with a fraction of a cent ($10.875) is shown exactly in the ledger.
Rules applied
| Rule |
What the engine does |
Source (opened October 26, 2026) |
| Federal overtime rate |
1.5x the regular rate for hours over 40 in a workweek |
29 U.S.C. 207(a)(1) (Cornell LII); DOL WHD Overtime Pay |
| Each workweek alone |
Payroll splits each workweek at 40; never averages |
29 CFR 778.104 (Cornell LII mirror of eCFR) |
| Workweek definition |
Fixed, recurring 168 hours; any start day; change only if permanent and not to evade |
29 CFR 778.105 (Cornell LII) |
| No federal double time |
No 2x rate in the FLSA; weekend and holiday work not premium unless over 40 |
29 U.S.C. 207(a)(1); DOL Overtime Pay page |
| California double time |
2x over 12 hours in a workday (and over 8 on the 7th consecutive day) |
Cal. Labor Code 510(a); DIR Overtime FAQ |
| Differential in the regular rate |
Night-shift differentials, per hour or percentage, are included in the regular rate |
29 CFR 778.207(b) (Cornell LII); DIR Overtime FAQ for California |
| Regular rate with two rates |
Straight-time pay for the week divided by all hours worked |
29 CFR 778.115; DOL Fact Sheet 56A |
| Half-time premium method |
Straight time for all hours, plus 0.5 x regular rate x overtime hours |
29 CFR 778.110(b) |
| Weekend premium credit |
A 1.5x weekend or holiday premium may be excluded and credited |
29 U.S.C. 207(e)(6), 207(h)(2) |
| Clock rounding |
Nearest 5 minutes, 0.1 h or 0.25 h, if it does not underpay over time |
29 CFR 785.48(b) |
eCFR (ecfr.gov) redirected automated requests to an unblock page, so the regulation text was read on the Cornell LII mirror; page links point to eCFR.
Time and a half
| # |
Case |
Working |
Result |
| TH1 |
$20.00 |
20 x 1.5 |
$30.00 |
| TH2 |
$15.00 |
15 x 1.5 |
$22.50 |
| TH3 |
$16.90 |
16.90 x 1.5 = 25.35 |
$25.35 |
| TH4 |
$7.25 |
7.25 x 1.5 = 10.875, shown $10.88, kept exact |
$10.88 |
| TP2 |
29 CFR 778.110(a): $12.00, 40 + 6 OT |
40 x 12 = 480.00; 6 x 18 = 108.00 |
$588.00 (regulation's figure) |
| TP3 |
$15.50, 40 + 1.25 OT |
620.00; 1.25 x 23.25 = 29.0625 to 29.06 |
$649.06 |
| TP4 |
$7.25, 5 OT |
5 x 10.875 = 54.375, half-up |
$54.38 (not 5 x 10.88 = 54.40) |
| TP5 |
$7.25, 3 OT |
3 x 10.875 = 32.625, half-up |
$32.63 |
| TP10 |
$9,999.99, 168 OT |
168 x 14,999.985 |
$2,519,997.48 |
| TR1/TR2 |
Reverse $30.00 and $25.00 |
30 / 1.5; 25 / 1.5 = 16.667 |
$20.00, $16.67 |
| Ladder |
$7.25 at 1x, 1.5x, 2x, 2.5x |
7.25; 10.875; 14.50; 18.125 |
$7.25 / $10.88 / $14.50 / $18.13 |
Double time
| # |
Case |
Working |
Result |
| DR1 |
$20.00 x 2 |
|
$40.00 |
| DR2 |
$20.00 x 2.5 |
|
$50.00 |
| DR4 |
$7.25 x 2.5 |
18.125 half-up |
$18.13 |
| DP1 |
$18.75: 40 reg, 8 at 1.5x, 4 at 2x |
750.00 + 8 x 28.125 = 225.00 + 4 x 37.50 = 150.00 |
$1,125.00 |
| DP3 / DC1 |
California 13-h day at $20.00 |
8 reg 160.00; hours 9 to 12 at 30.00 = 120.00; hour 13 at 40.00 |
$320.00 (8 / 4 / 1) |
| DC2 |
California 10-h day |
8 / 2 / 0 |
|
| DC3 |
California 12-h day |
8 / 4 / 0, no double time at exactly 12 |
|
| DC4 |
California 24-h day |
8 / 4 / 12 |
|
| Page |
11.5-h day at $20 |
160.00 + 3.5 x 30.00 |
$265.00 |
| DP6 |
$9,999.99, 24 h at 2.5x |
24 x 24,999.975 |
$599,999.40 |
Shift differential
| # |
Case |
Working |
Result |
| SD1 |
45 h at $20.00, 10 h at +$2.00 |
base 900.00 + diff 20.00 = 920.00; RR 920 / 45 = 20.4444; premium 5 x 920 / (2 x 45) = 51.111 to 51.11 |
$971.11 (base-rate-only method gives $970.00, short $1.11) |
| SD2 |
40 h at $20.00, 10% on 8 h |
diff 8 x 2.00 = 16.00; no overtime |
$816.00 |
| SD3 |
29 CFR 778.110(b) numbers: $12.00, 46 h, one $46.00 payment |
552.00 + 46.00 = 598.00; RR 13.00; 6 x 6.50 = 39.00 |
$637.00 (regulation's figure) |
| SD4 |
50 h at $18.00, 15% on 20 h |
diff 20 x 2.70 = 54.00; straight 954.00; RR 19.08; 10 x 9.54 = 95.40 |
$1,049.40 (short $5.40 the wrong way) |
| SD5 |
42 h at $20.00, 3 shifts x $25.00 |
840.00 + 75.00 = 915.00; premium 2 x 915 / 84 = 21.786 to 21.79 |
$936.79 |
| SD6 |
Differential on 0 hours |
plain overtime |
$950.00, no shortfall |
| SD11 |
48 h all at +$3.00 |
same as $23.00 an hour: 1,104.00 + 8 x 11.50 |
$1,196.00 |
| Page |
168 h at $9,999.99, all +$999.99 |
1,679,998.32 + 167,998.32 = 1,847,996.64; premium 128 x 1,847,996.64 / 336 = 703,998.72 |
$2,551,995.36 |
| Refused |
Differential hours over the week; part shifts; week over 168 |
|
error |
Payroll hours
| # |
Case |
Working |
Result |
| PH1 |
Ana $20.00: 40 + 40 |
|
80 reg, 0 OT, $1,600.00 |
| PH2 |
Ben $18.00: 30 + 50 |
wk1 540.00; wk2 720.00 + 10 x 27.00 = 270.00 |
70 reg, 10 OT, $1,530.00 (averaging would pay $1,440.00) |
| PH3 |
Cleo $25.00: 45.5 + 38 |
78 x 25 = 1,950.00; 5.5 x 37.50 = 206.25 |
$2,156.25 |
| PH4 |
All three, biweekly |
|
243.5 h, 228 reg, 15.5 OT, $5,286.25 |
| PP12 |
40:20 at $18.00 |
720.00 + 0.3333 x 27.00 = 9.00 |
$729.00 (minutes stay exact) |
| PS3 |
Semi-monthly standard |
2,080 / 24 = 86.667 |
86.67 h |
| PS4 |
Monthly standard |
2,080 / 12 = 173.333 |
173.33 h |
| Page |
2 x 168 h at $9,999.99 |
each week 40 x 9,999.99 = 399,999.60 plus 128 x 14,999.985 = 1,919,998.08, so 2,319,997.68 a week |
$4,639,995.36 |
Checked through the pages
Standalone press scripts, qa/press-<page>.mjs, run on port 8773 at 1440 x 900 and 390 x 844: time and a half 135 of 135, double time 127 of 127, shift differential 117 of 117, payroll hours 130 of 130. Each checks the cases above through the UI, every control on hover and focus, every toggle for geometry (no element moves more than 0.5 px), errors that name the field, empty and huge input, share URL restore, copy text, reset, keyboard order, the mobile fold and anchor ad, print, and ads on and off.
Not covered
- California weekly overtime and the 7th-day rule on the double time page (one day only; links to the overtime calculator).
- Daily overtime states on the shift differential and payroll pages (federal 40-hour rule only).
- Semi-monthly and monthly payroll in the tool (workweeks do not line up with those periods; the page explains and gives standard hours).
- Bonuses other than a flat amount entered as one "shift".
Not legal, tax or payroll advice. Reviewer to be confirmed.
Group D math: test cases
Engines are in js/engines/. Run the tests from prototype/ with node tests/<slug>.test.js. The result on October 26, 2026: no tax on overtime 46 of 46, salary to hourly 25 of 25, PTO 27 of 27, minor work hours 29 of 29. Each money test file also runs 5,000 seeded random cases against exact integer-cent arithmetic (BigInt, half-up); all pass.
Money is rounded half-up to the cent once per displayed line, never on an intermediate figure that feeds later math. The helper multiplies by 100 and strips binary noise with toPrecision(15) before rounding, so 2.675 becomes 2.68.
Sources were opened on October 26, 2026. DOL pages block this machine's curl, so they were read through WebFetch.
No tax on overtime (26 U.S.C. 225)
Rules applied
| Rule |
What the engine does |
Source |
| Qualified overtime |
Hours over 40 in each FLSA workweek x 1/2 x the FLSA regular rate. Only the half counts, even when the employer pays 2x. |
IRS FS-2026-13 Q12 and Q16; 26 U.S.C. 225(c)(1) |
| Cap |
Smaller of qualified overtime and $12,500, or $25,000 on a joint return (per return) |
26 U.S.C. 225(b)(1); FS-2026-13 Q2 |
| Phase-out |
Less $100 for each full $1,000 of MAGI over $150,000 ($300,000 joint); partial thousands are dropped |
26 U.S.C. 225(b)(2); Schedule 1-A (2025) lines 17 to 21 |
| Eligibility |
$0 if married filing separately, if not FLSA overtime-eligible, or without a valid SSN |
26 U.S.C. 225(d), (e); FS-2026-13 Q4, Q24, Q25 |
| Years |
2025 to 2028 only |
26 U.S.C. 225(g) |
| 2025 pay-stub methods |
Premium only at 1.5x: x1; full OT pay at 1.5x: x1/3; premium at 2x: x1/2; full OT pay at 2x: x1/4 |
Notice 2025-69 III.B.2 (A) to (D), examples 1 to 4 |
Cases
| # |
Inputs |
Working |
Result |
| N1 |
50 h at $20, paid double time (FS-2026-13 Q16) |
10 x $10 |
$100.00 |
| N2 to N5 |
Notice 2025-69 examples 1 to 4: $5,000 premium; $15,000 full at 1.5x; $10,000 premium at 2x; $20,000 full at 2x |
x1, /3, /2, /4 |
$5,000.00 each |
| N6 |
$30,000 qualified (FS Q10), single / joint |
cap |
$12,500.00 / $25,000.00 |
| N7 |
50 weeks of 50 h at $20, MAGI $90,000 single |
500 x $10 |
$5,000.00 |
| N8 |
California 4 x 10 h = 40 h week |
0 h over 40 |
$0.00 |
| N11 |
20 wk of 45 h at $18 + 10 wk of 52 h at $22 |
5 x 9 x 20 + 12 x 11 x 10 |
$2,220.00 |
| N12 |
41.25 h at $15.55 |
1.25 x 7.775 = 9.71875 |
$9.72 |
| P1 to P4 |
$5,000 qualified, MAGI $150,000 / $150,001 / $150,999.99 / $151,000 |
0, 0, 0, 1 thousands |
$5,000 / $5,000 / $5,000 / $4,900 |
| P5 |
$12,500, MAGI $175,500 |
25 x $100 |
$10,000.00 |
| P6 |
$12,500, MAGI $275,000 |
125 x $100 |
$0.00 |
| P9 |
joint $20,000, MAGI $320,000 |
20 x $100 |
$18,000.00 |
| P10 |
joint $30,000, MAGI $350,000 |
cap to $25,000, then 50 x $100 |
$20,000.00 |
| E1 to E5 |
MFS; exempt; no SSN; year 2024; year 2029 |
not allowed / refused |
$0.00 or refused |
| Z4 |
168 h at $9,999.99 |
128 x $4,999.995 |
$639,999.36 |
| S1 to S3 |
$5,000 at 12%; $12,500 at 22%; $4,900.50 at 37% |
x rate |
$600.00 / $2,750.00 / $1,813.19 |
Salary to hourly
| # |
Inputs |
Working |
Result |
Source |
| R1 |
$350 a week for 35 h |
350 / 35 |
$10.00 |
29 CFR 778.113(a) |
| R2 |
$375 a week for 40 h |
9.375 half-up |
$9.38 |
778.113(a) |
| R3 |
$1,560 a month, 40 h |
1,560 x 12 / 52 = 360; / 40 |
$9.00 |
778.113(b) |
| R4 |
$780 twice a month, 40 h |
780 x 24 / 52 = 360; / 40 |
$9.00 |
778.113(b) |
| A1 |
$70,000 a year, 2,080 h |
33.6538 |
$33.65 |
arithmetic |
| A3 |
$60,000 at 37.5 h x 52 |
/ 1,950 |
$30.77 |
arithmetic |
| A4 |
$70,000 over 48 weeks |
/ 1,920 |
$36.46 |
arithmetic |
| A8 |
$20, 40 h + 5 OT h at 1.5x, 52 wk |
(800 + 150) x 52 |
$49,400.00 |
arithmetic |
| E1, E2 |
0 hours or 0 weeks |
refused |
refused |
|
The 2,087-hour federal divisor in the article is from OPM, "Computing Hourly Rates of Pay Using the 2,087-Hour Divisor" (5 U.S.C. 5504(b)).
PTO
There is no federal PTO law: the FLSA "does not require payment for time not worked, such as vacations, sick leave or federal or other holidays" (DOL, Vacation Leave). All rates are the user's policy.
| # |
Inputs |
Working |
Result |
| B1 |
1 h per 30 worked, 80 h a period, 26 periods |
2,080 / 30 |
69.33 h |
| B2 |
4 h a period x 26 |
|
104 h |
| B3 |
4 h a period, cap 80 |
full at period 20; 24 h not earned |
80 h |
| B4 |
40 h x $22.00 |
|
$880.00 |
| C2 |
start 100 over a cap of 80 |
balance kept, nothing earned |
100 h |
| C5 |
start 80 at cap 80, 52 h taken over 26 periods |
refills 2 h a period |
78 h, 54 h not earned |
| C7 |
104 h in 7.5-hour days |
13.867 |
13.87 days |
| Z5 |
69.33 h x $15.55 (displayed hours x rate) |
1,078.0815 |
$1,078.08 |
Minor work hours (29 CFR 570.35, ages 14 and 15, non-farm)
| # |
Week |
Limit tested |
Result |
| L1 |
Tue 3:30 to 7:00 p.m., school day |
3 h on a school day, 570.35(a)(5) |
flagged |
| L2 |
Fri 4 to 7 p.m., school day |
Fridays count; exactly 3 h |
allowed |
| L3 |
5 x 3 h school days + 4 h Saturday = 19 h |
18 h school week, (a)(3) |
flagged |
| L4 |
Saturday 8 a.m. to 5 p.m. = 9 h |
8 h non-school day, (a)(4) |
flagged |
| L5, L6 |
6 x 7 h = 42 h / 5 x 8 h = 40 h, summer |
40 h non-school week, (a)(2) |
flagged / allowed |
| L7 |
6:30 a.m. start |
7 a.m., (a)(6) |
flagged |
| L8, L9 |
ends 7:30 p.m. in October / in July |
7 p.m., 9 p.m. June 1 to Labor Day, (a)(6) |
flagged / allowed |
| L10 |
ends 9:15 p.m. in July |
9 p.m. |
flagged |
| L11 |
one school day, 4 x 5 h on other days = 20 h |
school week = any day in session, 570.35(b) |
flagged |
| A1 to A3 |
16 or 17; under 14; 18+ |
FS #43; 570.2 |
no limit / not allowed / not covered |
| D1, D2 |
Labor Day 2026 and 2027 |
first Monday of September |
Sep 7, 2026; Sep 6, 2027 |
| E2 |
10 p.m. to 2 a.m. |
overnight |
flagged late |
Not covered yet
- No tax on overtime: overtime under 29 U.S.C. 207(j), (k), (o) and federal employees on OPM rules are explained in the FAQ, not computed. Regular rate is one hourly figure per row; bonuses are not added.
- Minor work hours: no state rules (state rows are not shown until each is verified against the state's own law), no check against school hours, no WECEP or work-study limits, no farm work.
- PTO: no state payout or sick-leave rules are named.
Not legal, tax or payroll advice.
Group E math: test cases
Engines are in js/engines/ (source in src/engines/). Run from prototype/ with node tests/<slug>.test.js. Result on October 27, 2026: pay raise 43 of 43, business days 49 of 49, holiday pay 30 of 30. Sources were opened on October 27, 2026.
Money is rounded half-up to the cent once per displayed line; a total is the sum of its rounded lines.
Pay raise
| Rule |
What the engine does |
Source |
| Periods |
Pay is turned into a yearly figure (hourly x hours a week x paid weeks, weekly x weeks, every two weeks x weeks / 2, twice a month x 24, monthly x 12), raised, then divided back out per period |
Arithmetic; salary method as 29 CFR 778.113 |
| Back pay |
Hourly raise x regular hours + 1.5 x hourly raise x overtime hours, where all hours (overtime included) are typed or estimated as weekdays from the raise date up to, not including, the first day at the new rate, x min(hours a week, 40) / 5, plus the overtime hours. Fixed 2026-10-27 (legal review row 1): typed hours that included overtime were paid 2.5x the raise per OT hour |
29 CFR 778.303 |
| # |
Inputs |
Expected |
Working |
| R1 |
Retroactive raise of $0.10/h, 1 overtime hour |
$0.15 |
778.303's own example: 1.5 x $0.10 |
| P1 |
$20.00/h, 3% |
$20.60/h, $41,600 to $42,848 a year |
20 x 1.03; 2,080 h |
| P2 |
$50,000/yr, 5% |
$52,500, $4,166.67 to $4,375.00 a month |
50,000 x 1.05; / 12 |
| X1-X5 |
$4,000/month, 15%, 40 h (goodcalculators.com default) |
$23.08 to $26.54/h; $2,000 to $2,300 twice a month; $48,000 to $55,200 |
Same figures as that site, to the cent |
| A1 |
$18.00/h + $1.50 |
$19.50/h, 8.33% |
1.50 / 18 |
| N1 |
$48,000 to $52,000 |
8.33% |
4,000 / 48,000 |
| I1 |
5% raise, 3% inflation |
1.94% real |
1.05 / 1.03 - 1 |
| B1 |
$1.00/h, raise Tue Sep 1, 2026, new rate from Thu Oct 1, 40 h/wk, 10 OT h |
$191.00 |
22 weekdays x 8 h = 176 h x $1.00 = $176.00; 10 x $1.50 = $15.00 |
| L1 |
$1.00/h, same period, 186 h typed incl. 10 OT h |
$191.00 |
176 x $1.00 + 10 x $1.50 (was $201.00 before the fix) |
| L5 |
Hours blank, 45 h/wk, 22 OT h |
$209.00 |
22 x 8 + 22 = 198 h; 176 x $1.00 + 22 x $1.50 |
| B3 |
3% of $70,000, Aug 3 to Sep 14, 2026 |
$242.31 |
30 weekdays x $2,100 / 260 |
| Q1 |
5,000 seeded salaries and raises |
0 cent errors |
Against integer-cent BigInt, half-up |
Business days
| Rule |
What the engine does |
Source |
| Holidays |
The eleven in 5 U.S.C. 6103(a); MLK Day from 1986, Juneteenth from 2021; holidays applied from 1978 |
5 U.S.C. 6103(a); OPM schedules |
| Observed days |
Saturday to the Friday before, Sunday to the Monday after |
5 U.S.C. 6103(b)(1); OPM (E.O. 11582) |
| Counting |
Start and end counted unless unticked; a holiday on a day off counts once, as a day off |
Convention, shown on the page |
| Adding |
The start date is not counted; 1 business day after Friday is Monday |
Convention, shown on the page |
| # |
Inputs |
Expected |
Working |
| OPM |
Every year 2020 to 2030 |
Matches every OPM row (Inauguration Day excluded) |
Includes Dec 31, 2021 and Dec 31, 2027 for the next New Year's Day |
| C1 |
Mon Nov 2 to Fri Nov 6, 2026 |
5 |
|
| C3 |
Nov 23 to 27, 2026 |
4 |
Thanksgiving Nov 26 |
| C4 |
All of 2026 |
250 |
365 days from a Thursday = 261 weekdays, less 11 holidays (Jul 4 observed Fri Jul 3) |
| C5 |
All of 2027 |
249 |
261 weekdays less 12: the 11 of 2027 plus New Year's Day 2028 on Fri Dec 31 |
| C7 |
Sunday-only weekend, Mon Nov 2 to Sun Nov 8 |
6 |
|
| A1 |
10 business days after Wed Nov 18, 2026 |
Thu Dec 3 |
Thanksgiving skipped; without holidays Wed Dec 2 (A2) |
| A5 |
1 business day before Tue Jan 20, 2026 |
Fri Jan 16 |
MLK Day Jan 19 skipped |
| P1 |
3,000 seeded starts and counts |
Adding k then counting gives k |
|
| H2026, H2027 |
The tables printed on the page |
Equal the engine |
|
Holiday pay
| Rule |
What the engine does |
Source |
| No federal requirement |
Holiday pay and premium are inputs, never assumed |
DOL, Holiday Pay |
| Premium of 1.5x or more |
Left out of the regular rate; credited against the half-time overtime premium due |
29 CFR 778.203; 29 U.S.C. 207(e)(6), (h)(2) |
| Premium under 1.5x |
Added into the regular rate; not credited |
29 CFR 778.203 |
| Holiday not worked |
Paid at the rate, not hours worked, out of the regular rate, never credited |
29 CFR 778.218(a), 778.219 |
| # |
Inputs |
Expected |
Working |
| R1 |
$12, 9 holiday h at 1x, 8 idle holiday h, 41 other h |
$756.00 |
778.219(a)(2): $600 + $96 + $60 (10 h x $6) |
| S1 |
$20, 8 h, 1.5x |
$240.00, premium $80.00 |
8 x $30 |
| W1 |
$20, 40 other + 8 holiday h at 1.5x |
$1,040.00 |
Due 8 x $10 = $80, credited $80 |
| W3 |
Same at 1.25x |
$1,083.33 |
Regular rate $1,000 / 48 = $20.8333; 8 x $10.4167 = $83.33 |
| W4 |
$20, 50 other + 8 holiday h at 1.5x |
$1,340.00 |
Due 18 x $10 = $180, credit $80, owed $100 |
| W6 |
$20, 40 other h, 8 idle holiday h |
$960.00 |
Idle hours do not count toward 40 |
| Q1 |
4,000 seeded weeks at 1.5x to 3x |
Never below plain FLSA pay |
|
Not covered: state holiday rules, union contracts, salaried exempt employees, and the 8-hour daily rules of 5 U.S.C. 5546 for federal workers (explained on the page, not calculated).