DEV Community

Mobeen Ahmed
Mobeen Ahmed

Posted on

Weekly Overtime vs Daily Overtime: Why One Timesheet Needs Two Different Rules

I built my time card calculator to answer one question: how much should this week pay? I assumed the answer was one rule. It is not. In the United States, overtime comes in two flavours, and a single timesheet can trigger both.

The federal rule is the weekly one. Under the Fair Labor Standards Act, hours over 40 in a workweek are paid at time and a half. That is the rule most people know, and it is the only rule most states add nothing to. Work 45 hours in a week and five of them are at 1.5x. Simple — until a state adds a daily rule on top.

California is the famous example. There, hours over 8 in a single day are overtime, and hours over 12 are double time, whatever the week total says. So a worker who does four 10-hour days has worked 40 hours in the week — no weekly overtime at all — but is still owed 8 hours at time and a half, because each day ran 2 hours past the daily limit. The same timesheet, two answers, and the daily rule pays more.

That is the trap I walked into when I first coded the calculator. My first version summed the week, checked 40, and stopped. It was correct for most of the country and quietly wrong for California, Alaska, Nevada, Colorado, and a handful of others. The fix was not complicated, but it changed the shape of the code: I now calculate daily overtime first, day by day, then calculate weekly overtime on what is left.

The order matters. If you apply the weekly rule first and then add daily overtime on top, you pay some hours twice. The correct approach is to strip out the daily overtime hours, look at the remaining regular hours across the week, and only then check whether those pass 40. It is a small detail and the kind of thing that is easy to get wrong in a spreadsheet, which is exactly why I wanted the calculator to handle it.

Each state page on mytimecardcal.com carries its own rule set in a small data table — daily threshold, double-time threshold, weekly threshold, seventh-day rule — and one shared JavaScript function reads the table and does the maths. California's table says 8, 12, 40, seventh day; a state with no daily rule just says 40 a week. The code never branches on a state name; it only reads numbers. That is what made 51 state pages possible without 51 copies of the logic.

There are edge cases that still surprise me. Nevada's daily rule only applies below a pay threshold, so the same 10-hour day can be overtime for one worker and straight time for another. Kentucky pays overtime on the seventh consecutive day even if the week total is under 40. And the seventh-day rule in California means a worker who clocks in seven days running gets time and a half for the first 8 hours of that seventh day, then double time after that — on top of whatever the week already owed.

I check the rules against the state labour department pages, not against other calculators, because the wage correction I had to make in November taught me that copying a table you have not verified is how wrong numbers spread. One table was a month out of date and Florida's minimum wage was wrong on every page until I fixed it the same evening.

The lesson I took from all of this is boring and useful: overtime is not one rule, it is a stack of rules, and the order you apply them in is part of the answer. Get the order right, keep the rules in data rather than in code, and a single timesheet can give the right answer in every state.

Top comments (0)