A week worked in several countries
The rule
One person in one week can fall under several countries’ rules at once. A German contract, Monday and Tuesday in Munich, Wednesday to Friday in Paris:
- the law governing the contract (German working-time law) applies to the whole week, counting every hour worked, in Germany or in France;
- each day’s public holidays are those of the country worked in that day: 14 July is a holiday in Paris, Corpus Christi is one in Munich and not in Paris;
- each line of time records the country it was worked in, for payroll, tax and social security to read.
Who uses it
Employers whose people work across borders: engineers and technicians on assignment, sales staff, drivers, consultants, and anyone posted or travelling for work.
How the recipe does it
Configuration only. Where someone works on a day is known two ways:
- a dated work location in setup: an employment change places the
person at Paris from Wednesday. The day’s zone, its holidays and the
layers whose rule reads
locationorjurisdictionfollow it. It is known before any punch, so it also decides days not worked: a holiday. - the punch: a clock’s route can give a code with each punch
(
site = paris), and the line takes it.
Each work location gives the labor context its days’ work takes
(values), and an implication can say what a clock’s site means:
[[location]]id = "paris"zone = "Europe/Paris"jurisdiction = "fr"values = { country = "fr" }metadata = { holidays = ["jour-de-l-an", "lundi-de-pentecote", "fete-nationale"] }
[[implication]]when = { site = "paris" }then = { country = "fr" }A line’s context takes each value from the first source that gives it: the punch, the scheduled shift, the day’s work location, the assignment, the person’s and the tenant’s defaults. So the punch wins for the line, and the dated work location decides the day.
The package (package.toml) has two layers. Holidays, for everyone: a
holiday is observed only where the day’s work location lists it, and
pays its scheduled hours on a scheduled day:
[[layer]]id = "holidays"[[layer.step]]id = "where"uses = "standard/location_holidays"[[layer.step]]id = "holiday-pay"uses = "standard/holiday_pay"params = { time = "scheduled", category = "holiday", scheduled_only = true }The contract’s working-time rules, for the employer’s people, picked by the employer (the party to the contract), not by where the work is done:
[[layer]]id = "german-contract"applies_to = "employer = acme-de"[[layer.step]]id = "day"uses = "standard/limit"params = { over = "10h", kind = "day_over_10h" }[[layer.step]]id = "week"uses = "standard/limit"params = { over = "48h", window = "week", kind = "week_over_48h", about = "day" }A layer picked by jurisdiction applies only on the days the person is
at a location of it, and a weekly step counts only those days: the
contract’s rules are picked by what does not change in the week (the
employer, or an employment attribute naming the contract’s law).
Parameters
| Step | Parameter | Meaning |
|---|---|---|
location_holidays | key | The location metadata key the list of holiday ids is kept under (default holidays). |
holiday_pay | time, category, scheduled_only | A scheduled day’s hours, in holiday, only on a day with a shift. |
limit (day) | over, kind | The longest day (10h), and the exception raised past it. |
limit (week) | over, window, kind, about | The longest week (48h), counted over every day of it, the exception about the week. |
| Setup | Meaning |
|---|---|
A location’s values | The labor context its days’ work takes (country = fr). |
An employment change’s location | Where the person works from that day: the day’s zone, holidays and layers. |
| An implication | What a clock’s site means (site = paris means country = fr). |
What the scenarios show
bastille-day-in-paris-is-a-holiday: Monday and Tuesday in Munich record Germany, Thursday and Friday in Paris record France, and Wednesday 14 July, in Paris, pays its 8 hours of holiday.corpus-christi-is-not-kept-in-paris: Thursday 27 May 2027 worked in Paris is a working day; Munich would have kept it.the-contracts-limits-count-every-countrys-hours: an 11-hour Friday in Paris is a day over 10 hours, and 51 hours across both countries a week over 48.a-clocks-site-says-where-the-line-was-worked: placed in Munich, Wednesday punched at the Paris site’s clock records France and the site; 14 July is a working day, the person being placed in Munich.
Legal note
This is a common way to model work across borders; check the rules where you operate. Which law governs a contract, which country’s holidays a worker keeps, and which working-time limits apply to work abroad depend on the contract, the countries and any agreement: the layers and the tenant’s data say it. Tax and social security are decided by the systems that own them, from the facts this records.
Get the recipe
The recipe’s package and its scenarios are in the example packages repository: attendance/work_in_several_countries. 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:
name = "work_in_several_countries"version = "1.0.0"description = "A week worked in two countries: the contract's working-time rules count every hour of it, each day keeps the public holidays of the country it is worked in, and each line records its country."
# Everyone: a holiday is observed only where the person's work location# that day lists it (its metadata's holidays), and a holiday observed on a# scheduled day pays its scheduled hours, in holiday.[[layer]]id = "holidays"[[layer.step]]id = "where"uses = "standard/location_holidays"[[layer.step]]id = "holiday-pay"uses = "standard/holiday_pay"params = { time = "scheduled", category = "holiday", scheduled_only = true }
# The employees of acme-de work under a German contract: Germany's# working-time rules apply to all their work, wherever it is done. A day# of more than 10 hours, and a week of more than 48, are flagged, counting# every hour in every country.[[layer]]id = "german-contract"applies_to = "employer = acme-de"[[layer.step]]id = "day"uses = "standard/limit"params = { over = "10h", kind = "day_over_10h" }[[layer.step]]id = "week"uses = "standard/limit"params = { over = "48h", window = "week", kind = "week_over_48h", about = "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).
Placed in Munich all week, Wednesday to Friday punched at the Paris site's clock (its route's code site = paris): those lines record France, the punch winning for the line; the day's holidays follow where the person is placed, so 14 July is a working day
description = "Placed in Munich all week, Wednesday to Friday punched at the Paris site's clock (its route's code site = paris): those lines record France, the punch winning for the line; the day's holidays follow where the person is placed, so 14 July is a working day"
[[punch]]at = "2027-07-12 08:00"kind = "in"[[punch]]at = "2027-07-12 16:00"kind = "out"[[punch]]at = "2027-07-14 08:00"kind = "in"values = { site = "paris" }[[punch]]at = "2027-07-14 16:00"kind = "out"values = { site = "paris" }
[policy]zone = "Europe/Berlin"
[person]employer = "acme-de"
[[location]]id = "munich"zone = "Europe/Berlin"jurisdiction = "de-by"values = { country = "de" }metadata = { holidays = ["neujahr", "pfingstmontag", "fronleichnam", "tag-der-deutschen-einheit"] }
[[location]]id = "paris"zone = "Europe/Paris"jurisdiction = "fr"values = { country = "fr" }metadata = { holidays = ["jour-de-l-an", "lundi-de-pentecote", "fete-nationale"] }
[[employment]]effective = "2027-01-04"kind = "hired"location = "munich"
[[implication]]when = { site = "paris" }then = { country = "fr" }
[[holiday]]id = "fete-nationale"name = "Fete nationale"month = 7day = 14
[[category]]id = "holiday"worked = false
[[shift_definition]]id = "days"start = "08:00"end = "16:00"days = ["monday", "wednesday"]
[expect]week = "2027-07-12"worked = "16h"allocations = [ "2027-07-12 08:00-16:00 work 8.00 country=de", "2027-07-14 08:00-16:00 work 8.00 country=fr site=paris",]A German contract, Monday and Tuesday in Munich, Wednesday to Friday in Paris: Wednesday 14 July is a French public holiday, observed there and paid; each line records its country
description = "A German contract, Monday and Tuesday in Munich, Wednesday to Friday in Paris: Wednesday 14 July is a French public holiday, observed there and paid; each line records its country"
punch = [ { at = "2027-07-12 08:00", kind = "in" }, { at = "2027-07-12 16:00", kind = "out" }, { at = "2027-07-13 08:00", kind = "in" }, { at = "2027-07-13 16:00", kind = "out" }, { at = "2027-07-15 08:00", kind = "in" }, { at = "2027-07-15 16:00", kind = "out" }, { at = "2027-07-16 08:00", kind = "in" }, { at = "2027-07-16 16:00", kind = "out" },]
[policy]zone = "Europe/Berlin"
[person]employer = "acme-de"
[[location]]id = "munich"zone = "Europe/Berlin"jurisdiction = "de-by"values = { country = "de" }metadata = { holidays = ["neujahr", "pfingstmontag", "fronleichnam", "tag-der-deutschen-einheit"] }
[[location]]id = "paris"zone = "Europe/Paris"jurisdiction = "fr"values = { country = "fr" }metadata = { holidays = ["jour-de-l-an", "lundi-de-pentecote", "fete-nationale"] }
[[employment]]effective = "2027-01-04"kind = "hired"location = "munich"
[[employment]]effective = "2027-07-14"kind = "changed"location = "paris"
[[holiday]]id = "fete-nationale"name = "Fete nationale"month = 7day = 14
[[holiday]]id = "tag-der-deutschen-einheit"name = "Tag der Deutschen Einheit"month = 10day = 3
[[category]]id = "holiday"worked = false
[[shift_definition]]id = "days"start = "08:00"end = "16:00"days = ["monday", "tuesday", "wednesday", "thursday", "friday"]
[expect]week = "2027-07-12"worked = "32h"allocations = [ "2027-07-12 08:00-16:00 work 8.00 country=de", "2027-07-13 08:00-16:00 work 8.00 country=de", "2027-07-14 untimed holiday 8.00", "2027-07-15 08:00-16:00 work 8.00 country=fr", "2027-07-16 08:00-16:00 work 8.00 country=fr",]Thursday 27 May 2027 is Corpus Christi, a public holiday in Bavaria and not in France: worked in Paris, it is a working day like any other; in Munich it would have been a holiday
description = "Thursday 27 May 2027 is Corpus Christi, a public holiday in Bavaria and not in France: worked in Paris, it is a working day like any other; in Munich it would have been a holiday"
punch = [ { at = "2027-05-24 08:00", kind = "in" }, { at = "2027-05-24 16:00", kind = "out" }, { at = "2027-05-25 08:00", kind = "in" }, { at = "2027-05-25 16:00", kind = "out" }, { at = "2027-05-26 08:00", kind = "in" }, { at = "2027-05-26 16:00", kind = "out" }, { at = "2027-05-27 08:00", kind = "in" }, { at = "2027-05-27 16:00", kind = "out" }, { at = "2027-05-28 08:00", kind = "in" }, { at = "2027-05-28 16:00", kind = "out" },]
[policy]zone = "Europe/Berlin"
[person]employer = "acme-de"
[[location]]id = "munich"zone = "Europe/Berlin"jurisdiction = "de-by"values = { country = "de" }metadata = { holidays = ["neujahr", "pfingstmontag", "fronleichnam", "tag-der-deutschen-einheit"] }
[[location]]id = "paris"zone = "Europe/Paris"jurisdiction = "fr"values = { country = "fr" }metadata = { holidays = ["jour-de-l-an", "lundi-de-pentecote", "fete-nationale"] }
[[employment]]effective = "2027-01-04"kind = "hired"location = "munich"
[[employment]]effective = "2027-05-26"kind = "changed"location = "paris"
[[holiday]]id = "fronleichnam"name = "Fronleichnam"date = "2027-05-27"
[[category]]id = "holiday"worked = false
[[shift_definition]]id = "days"start = "08:00"end = "16:00"days = ["monday", "tuesday", "wednesday", "thursday", "friday"]
[expect]week = "2027-05-24"worked = "40h"allocations = [ "2027-05-24 08:00-16:00 work 8.00 country=de", "2027-05-25 08:00-16:00 work 8.00 country=de", "2027-05-26 08:00-16:00 work 8.00 country=fr", "2027-05-27 08:00-16:00 work 8.00 country=fr", "2027-05-28 08:00-16:00 work 8.00 country=fr",]Germany's working-time rules follow the German contract into France: an 11-hour Friday in Paris is a day over 10 hours, and 51 hours in Munich and Paris together are a week over 48
description = "Germany's working-time rules follow the German contract into France: an 11-hour Friday in Paris is a day over 10 hours, and 51 hours in Munich and Paris together are a week over 48"
punch = [ { at = "2027-07-05 07:00", kind = "in" }, { at = "2027-07-05 17:00", kind = "out" }, { at = "2027-07-06 07:00", kind = "in" }, { at = "2027-07-06 17:00", kind = "out" }, { at = "2027-07-07 07:00", kind = "in" }, { at = "2027-07-07 17:00", kind = "out" }, { at = "2027-07-08 07:00", kind = "in" }, { at = "2027-07-08 17:00", kind = "out" }, { at = "2027-07-09 07:00", kind = "in" }, { at = "2027-07-09 18:00", kind = "out" },]
[policy]zone = "Europe/Berlin"
[person]employer = "acme-de"
[[location]]id = "munich"zone = "Europe/Berlin"jurisdiction = "de-by"values = { country = "de" }
[[location]]id = "paris"zone = "Europe/Paris"jurisdiction = "fr"values = { country = "fr" }
[[employment]]effective = "2027-01-04"kind = "hired"location = "munich"
[[employment]]effective = "2027-07-07"kind = "changed"location = "paris"
[expect]week = "2027-07-05"worked = "51h"exceptions = [ { kind = "day_over_10h", at = "2027-07-09 07:00" }, { kind = "week_over_48h", at = "2027-07-05 00:00" },]