Skip to content

Automatic meal deduction

The rule

When someone works more than 6 hours in a day and no meal break shows in their punches, a 30-minute meal is deducted from their time. A meal shows either as a punched lunch or as a gap of at least 30 minutes between two stretches of work (punched out, then back in).

Who uses it

Employers whose staff are given an unpaid meal but often forget to punch it: restaurants, hospitals, warehouses. The deduction saves a supervisor correcting every timecard by hand. It is only fair where the meal really is taken: most employers pair it with a way for staff to say they worked through it (a correction that adds the punches, or a separate exception).

How the recipe does it

Configuration only: a package (package.toml) of one layer. Punched lunches go to meal; the standard auto_meal step deducts 30 minutes from a day worked past 6 hours with no meal, and then a daily threshold puts time past 8 hours in overtime. The categories are the tenant’s own setup.

[[layer]]
id = "meal"
settings = { categories = { lunch = "meal" } } # punched lunches go to "meal"
[[layer.step]]
id = "meal"
uses = "standard/auto_meal"
params = { after = "6h", meal = "30m", at = "5h", to = "meal_deducted" }
[[layer.step]]
id = "daily"
uses = "standard/threshold"
params = { over = "8h", to = "overtime", window = "day" }
[[category]]
id = "meal"
worked = false
paid = false
[[category]]
id = "meal_deducted"
worked = false
paid = false
  • A day worked past after has had a meal if it has time in the meal category (a punched lunch) or a gap of at least meal between two stretches of work.
  • With none, meal is deducted where the meal would have been taken: once at of the day’s work has passed (gaps not counted), the worked time from that instant to meal later moves to meal_deducted, a category neither worked nor paid. Should the day’s work end before that, what is left comes off its latest time. No time is lost: it is still on the timecard, stamped with why.

Deducting mid-shift keeps rules on the time of day right: a night premium still counts the shift’s last hours, and the deducted half hour is where a supervisor would expect it. Put this step before any overtime threshold, so overtime counts the time after the deduction.

Parameters

ParameterMeaning (default)
afterWorked time a day may have before a meal is due ("6h"); exactly this much is not past it.
mealThe meal’s length, deducted, and the shortest gap that counts as one ("30m").
atHow far into the day’s work the meal is deducted ("5h").
toThe category deducted time goes to ("meal_deducted"), set up as not worked and not paid.
meal_categoryWhere punched lunches are ("meal", the policy’s categories.lunch).

What the scenarios show

  • deducted-only-when-no-meal-was-taken: exactly 6 hours is not deducted; 6 hours and a minute is, from 13:00 to 13:30; a punched lunch and a 30-minute punched-out gap are meals; a 29-minute gap is not, and the deduction falls 5 hours into the work, the gap not counted.
  • deducted-before-overtime-is-counted: a 9-hour night shift with no meal has 01:00 to 01:30 deducted and is 8 hours 30 minutes worked, so only its last 30 minutes are overtime.

This is a common way companies implement automatic meal deductions; check the rules where you operate. Many places require that the meal actually be taken and free of work, and that staff can easily report a missed one.

Get the recipe

The recipe’s package and its scenarios are in the example packages repository: attendance/automatic_meal_deduction. Test it, or your own copy of it, with hourctl attend test, and publish it with hourctl attend pkg publish.

The policy package

The package’s layers, with the standard steps each one runs and their settings:

automatic_meal_deduction/package.toml
name = "automatic_meal_deduction"
version = "1.0.0"
description = "A day worked past 6 hours with no meal punched has 30 minutes deducted, as if the meal had been taken."
# Punched lunches go to "meal". A day worked past 6 hours with no meal
# has 30 minutes deducted, 5 hours into its work; then time past 8 hours
# a day is overtime, counted after the deduction.
[[layer]]
id = "meal"
settings = { categories = { lunch = "meal" } }
[[layer.step]]
id = "meal"
uses = "standard/auto_meal"
params = { after = "6h", meal = "30m", at = "5h", to = "meal_deducted" }
[[layer.step]]
id = "daily"
uses = "standard/threshold"
params = { over = "8h", to = "overtime", window = "day" }

Scenarios

Each scenario gives a person’s punches and setup and the timecard they must produce, worked out with this package adopted (the format).

A 9-hour night shift with no meal, across midnight: the meal is deducted 5 hours in, from 01:00 to 01:30, where it would have been taken, and before the daily threshold, so 8 hours 30 minutes are worked and only the last 30 minutes are overtime
scenarios/deducted-before-overtime-is-counted.toml
description = "A 9-hour night shift with no meal, across midnight: the meal is deducted 5 hours in, from 01:00 to 01:30, where it would have been taken, and before the daily threshold, so 8 hours 30 minutes are worked and only the last 30 minutes are overtime"
punch = [
{ at = "2026-10-05 20:00", kind = "in" }, { at = "2026-10-06 05:00", kind = "out" },
]
[policy]
zone = "America/Chicago"
[[category]]
id = "meal"
worked = false
paid = false
[[category]]
id = "meal_deducted"
worked = false
paid = false
[expect]
week = "2026-10-05"
worked = "8h 30m"
allocations = [
"2026-10-05 20:00-2026-10-06 01:00 work 5.00",
"2026-10-06 01:00-01:30 meal_deducted 0.50",
"2026-10-06 01:30-04:30 work 3.00",
"2026-10-06 04:30-05:00 overtime 0.50",
]
Monday's exactly 6 hours keep their time; Tuesday's 6 hours and a minute, with no meal, lose 30 minutes 5 hours in, 13:00 to 13:30; Wednesday's punched lunch is the meal; Thursday's 30 minutes punched out is the meal; Friday's 29 minutes punched out is too short to be one, so 30 minutes are deducted 5 hours into the day's work, the gap not counted
scenarios/deducted-only-when-no-meal-was-taken.toml
description = "Monday's exactly 6 hours keep their time; Tuesday's 6 hours and a minute, with no meal, lose 30 minutes 5 hours in, 13:00 to 13:30; Wednesday's punched lunch is the meal; Thursday's 30 minutes punched out is the meal; Friday's 29 minutes punched out is too short to be one, so 30 minutes are deducted 5 hours into the day's work, the gap not counted"
punch = [
{ at = "2026-10-05 08:00", kind = "in" }, { at = "2026-10-05 14:00", kind = "out" },
{ at = "2026-10-06 08:00", kind = "in" }, { at = "2026-10-06 14:01", kind = "out" },
{ at = "2026-10-07 08:00", kind = "in" }, { at = "2026-10-07 12:00", kind = "lunch_start" },
{ at = "2026-10-07 12:30", kind = "lunch_end" }, { at = "2026-10-07 16:30", kind = "out" },
{ at = "2026-10-08 08:00", kind = "in" }, { at = "2026-10-08 12:00", kind = "out" },
{ at = "2026-10-08 12:30", kind = "in" }, { at = "2026-10-08 16:30", kind = "out" },
{ at = "2026-10-09 08:00", kind = "in" }, { at = "2026-10-09 12:00", kind = "out" },
{ at = "2026-10-09 12:29", kind = "in" }, { at = "2026-10-09 16:30", kind = "out" },
]
[policy]
zone = "America/Chicago"
[[category]]
id = "meal"
worked = false
paid = false
[[category]]
id = "meal_deducted"
worked = false
paid = false
[expect]
week = "2026-10-05"
days = { "2026-10-05" = "6h", "2026-10-06" = "5h 31m", "2026-10-07" = "8h", "2026-10-08" = "8h", "2026-10-09" = "7h 31m" }
allocations = [
"2026-10-05 08:00-14:00 work 6.00",
"2026-10-06 08:00-13:00 work 5.00",
"2026-10-06 13:00-13:30 meal_deducted 0.50",
"2026-10-06 13:30-14:01 work 0.51",
"2026-10-07 08:00-12:00 work 4.00",
"2026-10-07 12:00-12:30 meal 0.50",
"2026-10-07 12:30-16:30 work 4.00",
"2026-10-08 08:00-12:00 work 4.00",
"2026-10-08 12:30-16:30 work 4.00",
"2026-10-09 08:00-12:00 work 4.00",
"2026-10-09 12:29-13:29 work 1.00",
"2026-10-09 13:29-13:59 meal_deducted 0.50",
"2026-10-09 13:59-16:30 work 2.52",
]