Skip to content

Time zones in one day

The rule

Someone who flies from London to Berlin in the middle of a shift clocks in by one clock and out by another, an hour apart. The time worked is the time between the two instants, not the difference of the two wall clocks: in at 08:00 in London and out at 18:00 in Berlin is 9 hours.

The day it belongs to is the workday the policy says: each workday starts at its start time (day_starts, midnight unless set) in the zone of that day. Moving east, the next workday starts sooner and the day of the move is shorter (23 hours from London to Berlin); moving west, it is longer (25). Every instant belongs to exactly one workday: none is counted twice, none is lost.

Who uses it

Airlines and travel crews, consultants and engineers who travel for work, drivers who cross a time zone, anyone placed at sites in several zones.

How the recipe does it

Configuration only. A punch is an instant (a clock’s time with its offset), so the time between two punches is exact whatever zones they were punched in. The zone of each day is the zone of the work location the person is placed at that day (local_time_at_each_site), else the policy’s:

[[employment]]
effective = "2026-10-06"
kind = "changed"
location = "berlin"

The package (package.toml) has one layer: work across a workday’s start is cut there, each piece in its own workday (attribute, split), and past 8 hours in a workday is overtime:

[[layer]]
id = "workdays"
[[layer.step]]
id = "split"
uses = "standard/attribute"
params = { mode = "split" }
[[layer.step]]
id = "daily"
uses = "standard/threshold"
params = { window = "day", over = "8h", to = "overtime" }

Without the split step, work across a workday’s start is the workday’s it starts in (start), or the one it ends in (end): the policy chooses the rule, and the engine keeps every instant in one workday.

Parameters

StepParameterMeaning
splitmodesplit: work across a workday’s start is cut there.
dailyover, toThe hours of a workday before overtime (8h).

What the scenarios show

  • a-flight-mid-shift-is-exact-time: in at 08:00 in London and out at 18:00 in Berlin is 9 hours, the ninth overtime.
  • flying-east-the-next-workday-starts-an-hour-sooner: from London on Monday to Berlin on Tuesday, a shift from 22:00 London to 01:00 Berlin is an hour on each day.
  • flying-west-the-workday-is-an-hour-longer: from Berlin to London, a shift from 23:30 Berlin to 00:30 London is an hour and a half on Monday and half an hour on Tuesday.

Which workday time across a zone change belongs to, and in which zone a day’s rules (a night premium, a daily limit) are read, can be set by law, contract or the employer’s practice: check the rules where you operate.

Get the recipe

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

time_zones_in_one_day/package.toml
name = "time_zones_in_one_day"
version = "1.0.0"
description = "Work in two time zones in one day, a flight from London to Berlin mid-shift: the hours are exact, and each instant belongs to one workday, cut at each workday's start in the zone of that day."
# Everyone: work across a workday's start is cut there, each piece in its
# own workday; past 8 hours in a workday is overtime.
[[layer]]
id = "workdays"
[[layer.step]]
id = "split"
uses = "standard/attribute"
params = { mode = "split" }
[[layer.step]]
id = "daily"
uses = "standard/threshold"
params = { window = "day", over = "8h", to = "overtime" }

Scenarios

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

In at 08:00 in London, a flight, out at 18:00 in Berlin: 9 hours exactly (07:00 to 16:00 UTC), not 10 by the two wall clocks, the ninth overtime; the day is worked out in London's zone, where the person is placed that day
scenarios/a-flight-mid-shift-is-exact-time.toml
description = "In at 08:00 in London, a flight, out at 18:00 in Berlin: 9 hours exactly (07:00 to 16:00 UTC), not 10 by the two wall clocks, the ninth overtime; the day is worked out in London's zone, where the person is placed that day"
punch = [
{ at = "2026-10-05 08:00 +01:00", kind = "in" },
{ at = "2026-10-05 18:00 +02:00", kind = "out" },
]
[policy]
zone = "Europe/London"
[[location]]
id = "london"
zone = "Europe/London"
values = { country = "gb" }
[[location]]
id = "berlin"
zone = "Europe/Berlin"
values = { country = "de" }
[[employment]]
effective = "2026-01-05"
kind = "hired"
location = "london"
[[employment]]
effective = "2026-10-06"
kind = "changed"
location = "berlin"
[expect]
week = "2026-10-05"
worked = "9h"
allocations = [
"2026-10-05 08:00-16:00 work 8.00 country=gb",
"2026-10-05 16:00-17:00 overtime 1.00 country=gb",
]
Placed in London on Monday and in Berlin from Tuesday: Tuesday starts at midnight in Berlin, 23:00 in London, so Monday is 23 hours long. A shift from 22:00 in London to 01:00 in Berlin is 2 hours: an hour on Monday, an hour on Tuesday, every instant in one workday
scenarios/flying-east-the-next-workday-starts-an-hour-sooner.toml
description = "Placed in London on Monday and in Berlin from Tuesday: Tuesday starts at midnight in Berlin, 23:00 in London, so Monday is 23 hours long. A shift from 22:00 in London to 01:00 in Berlin is 2 hours: an hour on Monday, an hour on Tuesday, every instant in one workday"
punch = [
{ at = "2026-10-05 22:00 +01:00", kind = "in" },
{ at = "2026-10-06 01:00 +02:00", kind = "out" },
]
[policy]
zone = "Europe/London"
[[location]]
id = "london"
zone = "Europe/London"
values = { country = "gb" }
[[location]]
id = "berlin"
zone = "Europe/Berlin"
values = { country = "de" }
[[employment]]
effective = "2026-01-05"
kind = "hired"
location = "london"
[[employment]]
effective = "2026-10-06"
kind = "changed"
location = "berlin"
[expect]
week = "2026-10-05"
worked = "2h"
days = { "2026-10-05" = "1h", "2026-10-06" = "1h" }
Placed in Berlin on Monday and in London from Tuesday: Tuesday starts at midnight in London, 01:00 in Berlin, so Monday is 25 hours long. A shift from 23:30 in Berlin to 00:30 in London is 2 hours: an hour and a half on Monday, half an hour on Tuesday
scenarios/flying-west-the-workday-is-an-hour-longer.toml
description = "Placed in Berlin on Monday and in London from Tuesday: Tuesday starts at midnight in London, 01:00 in Berlin, so Monday is 25 hours long. A shift from 23:30 in Berlin to 00:30 in London is 2 hours: an hour and a half on Monday, half an hour on Tuesday"
punch = [
{ at = "2026-10-05 23:30 +02:00", kind = "in" },
{ at = "2026-10-06 00:30 +01:00", kind = "out" },
]
[policy]
zone = "Europe/Berlin"
[[location]]
id = "berlin"
zone = "Europe/Berlin"
values = { country = "de" }
[[location]]
id = "london"
zone = "Europe/London"
values = { country = "gb" }
[[employment]]
effective = "2026-01-05"
kind = "hired"
location = "berlin"
[[employment]]
effective = "2026-10-06"
kind = "changed"
location = "london"
[expect]
week = "2026-10-05"
worked = "2h"
days = { "2026-10-05" = "1h 30m", "2026-10-06" = "30m" }