Skip to content

Night shift differential

The rule

Hours worked at night, between 22:00 and 06:00 on the wall clock, are paid at a night rate (a differential: a fixed amount or a percentage more per hour). Only the hours inside the window are night hours: a shift from 20:00 to 04:00 has 2 day hours and 6 night hours.

Who uses it

Employers who run around the clock and pay more for the night: hospitals, manufacturing, warehouses and distribution, security, public transport. Many collective agreements set the window and the rate.

How the recipe does it

Configuration only: a package (package.toml) of one layer running the standard window_premium step.

[[layer]]
id = "differential"
[[layer.step]]
id = "night"
uses = "standard/window_premium"
params = { during = { daily = { from = "22:00", to = "06:00" } }, category = "night" }

window_premium runs on each workday and moves the time of its worked lines that falls in during to night, splitting a line at the exact instant the period starts or finishes. during is a period: here each day’s hours from 22:00 to 06:00 on the wall clock (a to at or before from runs past midnight into the next day). It is wall time in the person’s zone: on the night the clocks go back it is an hour longer, and on the night they go forward an hour shorter. A night premium for some nights only is a period of those nights: weekend_night_premium.

night is a category of its own, worked and paid: payroll pays it at the night rate. Each step works on what the steps before it left: an overtime threshold after this one counts night time as worked and may move it to overtime; one before it has its overtime moved to night too, unless this step’s counts is ["work"]. Choose the order and counts your pay rules call for.

Parameters

ParameterMeaning
duringThe period whose time is night time: { daily = { from = "22:00", to = "06:00" } }.
categoryWhere night time goes.
countsThe categories moved (default: every worked one).

What the scenarios show

  • the-edges-of-the-night: a shift ending exactly at 22:00 has no night time, a minute later one minute; 22:00 to 06:00 is all night and stays one workday; a shift starting exactly at 06:00 is all day.
  • the-night-the-clocks-go-back: on November 1, 2026 in Chicago, 20:00 to 07:00 is 12 hours worked, 9 of them night.

This is a common way companies implement a night differential; check the rules where you operate. Few laws require one; where it is paid, the window, the rate and whether it applies to the whole shift come from a contract or company policy.

Get the recipe

The recipe’s package and its scenarios are in the example packages repository: attendance/night_differential. 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:

night_differential/package.toml
name = "night_differential"
version = "1.0.0"
description = "Time worked between 22:00 and 06:00 on the wall clock is paid in a night category, across midnight and changes of the clocks."
# Time worked between 22:00 and 06:00 on the wall clock goes to night,
# paid at the night rate.
[[layer]]
id = "differential"
[[layer.step]]
id = "night"
uses = "standard/window_premium"
params = { during = { daily = { from = "22:00", to = "06:00" } }, category = "night" }

Scenarios

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

Monday's shift ends exactly at 22:00: no night time. Tuesday's ends a minute later: one minute of night. Wednesday's runs 22:00 to 06:00, across midnight: all night, and all Wednesday's workday. Thursday's starts exactly at 06:00: all day time
scenarios/the-edges-of-the-night.toml
description = "Monday's shift ends exactly at 22:00: no night time. Tuesday's ends a minute later: one minute of night. Wednesday's runs 22:00 to 06:00, across midnight: all night, and all Wednesday's workday. Thursday's starts exactly at 06:00: all day time"
punch = [
{ at = "2026-10-05 14:00", kind = "in" }, { at = "2026-10-05 22:00", kind = "out" },
{ at = "2026-10-06 14:00", kind = "in" }, { at = "2026-10-06 22:01", kind = "out" },
{ at = "2026-10-07 22:00", kind = "in" }, { at = "2026-10-08 06:00", kind = "out" },
{ at = "2026-10-09 06:00", kind = "in" }, { at = "2026-10-09 14:00", kind = "out" },
]
[policy]
zone = "America/Chicago"
[expect]
week = "2026-10-05"
days = { "2026-10-05" = "8h", "2026-10-06" = "8h 1m", "2026-10-07" = "8h", "2026-10-09" = "8h" }
allocations = [
"2026-10-05 14:00-22:00 work 8.00",
"2026-10-06 14:00-22:00 work 8.00",
"2026-10-06 22:00-22:01 night 0.01",
"2026-10-07 22:00-2026-10-08 06:00 night 8.00",
"2026-10-09 06:00-14:00 work 8.00",
]
On the night of November 1, 2026, Chicago's clocks go back from 02:00 to 01:00. A shift from 20:00 to 07:00 on the wall clock is 12 hours worked: 2 before 22:00, 9 of night (the night is an hour longer) and 1 after 06:00
scenarios/the-night-the-clocks-go-back.toml
description = "On the night of November 1, 2026, Chicago's clocks go back from 02:00 to 01:00. A shift from 20:00 to 07:00 on the wall clock is 12 hours worked: 2 before 22:00, 9 of night (the night is an hour longer) and 1 after 06:00"
punch = [
{ at = "2026-10-31 20:00", kind = "in" }, { at = "2026-11-01 07:00", kind = "out" },
]
[policy]
zone = "America/Chicago"
[expect]
week = "2026-10-26"
worked = "12h"
allocations = [
"2026-10-31 20:00-22:00 work 2.00",
"2026-10-31 22:00-2026-11-01 06:00 night 9.00",
"2026-11-01 06:00-07:00 work 1.00",
]