Skip to content

Days present in each country

The rule

Tax treaties and social security rules count the days a person is present in a country: a worker present in another country more than 183 days in that country’s tax year may owe tax there. The days are counted in each country’s own tax year (the United Kingdom’s from 6 April, Australia’s from 1 July), and any part of a day counts: a day that starts in Paris and ends in Frankfurt is a day in each.

Time and Attendance reports the facts: the days present in each country, and the day a country’s count nears or passes the threshold, for someone to review. Payroll, tax and HR systems decide what follows.

Who uses it

Employers with people who work across borders, or are placed abroad for months: engineers, consultants, crews, posted and seconded staff.

How the recipe does it

Configuration only. Each line records its country (a work location’s values, or a clock’s site: work_in_several_countries), and each day the person is placed at a location is a day there, worked or not.

The package (package.toml) has one layer. The first step reports every day:

[[layer.step]]
id = "count"
uses = "standard/days_present"
params = { by = "country", measure = "days_present", located = true }

Each day present in a country is a count of 1 in days_present, with the country as its context: summed over any span (a tax year, a quarter) by an export or a report, it is the days present there.

Each country’s flags are a step of their own, for that country, in its tax year, with no measure (they report nothing more):

[[layer.step]]
id = "uk-near-183"
uses = "standard/days_present"
params = { by = "country", value = "gb", located = true, within = { every = "1y", starts = "04-06" }, days = 150, kind = "near_183_days_gb" }
[[layer.step]]
id = "uk-past-183"
uses = "standard/days_present"
params = { by = "country", value = "gb", located = true, within = { every = "1y", starts = "04-06" }, days = 184, kind = "past_183_days_gb" }
[[layer.step]]
id = "au-near-183"
uses = "standard/days_present"
params = { by = "country", value = "au", located = true, within = { every = "1y", starts = "07-01" }, days = 150, kind = "near_183_days_au" }
  • A day is present in each country any part of it has: its lines’ (what counts picks, default every worked category), the location the person is placed at that day (located), and where they live (residence, an employment attribute: frontier_workers).
  • The day a country’s days in the year holding it come to days raises kind, once: about that day’s latest line in the country, or the pay period’s first day where the day has none.
  • Days at a location are counted as the setup has them, ahead too: a placement recorded for next month counts next month’s days.

How a day is counted is not configured: any part of a day counts, as most treaties count it. A rule that counts presence at midnight, or a country of its own way of counting, needs the person’s whereabouts at that hour, which time worked does not tell.

What your setup needs

Set up before you adopt the recipe; the recipe’s steps read them by name, and adopting it is refused, with a list of what is missing, until they exist.

  • A measure called days_present: the amount the recipe adds up (money in a currency, or a count).

The scenarios show each as it was set up for them.

Parameters

StepParameterMeaning
countby, measureThe dimension of the country, and the measure the days are reported in.
countlocatedA day at a work location is a day in its country, worked or not.
uk-near-183, uk-past-183, au-near-183valueThe country counted.
withinIts tax year ({ every = "1y", starts = "04-06" }).
days, kindThe day of the count flagged (150: near 183; 184: past it), and the exception’s kind.

What the scenarios show

  • each-day-is-reported-in-each-country-it-has: two days in Germany and five in France, the weekend’s by the work location.
  • the-150th-day-of-the-uk-tax-year-is-flagged: in London since January, the count starts again on 6 April, and its 150th day, 2 September 2026, is flagged.
  • past-183-days-is-flagged: 6 October 2026, the 184th day, is flagged about the day’s work.
  • australias-tax-year-from-1-july: in Sydney since March, the 150th day of the tax year from 1 July, 27 November 2026, is flagged.

This is a common way to count days of presence; check the rules where you operate. Whether a day of presence counts in part or whole, which days count (weekends, holidays, days in transit), the tax year, and the threshold differ by country and by treaty, and residence is decided by more than days: the tax and social security systems decide, from the facts this records.

Get the recipe

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

days_present_by_country/package.toml
name = "days_present_by_country"
version = "1.0.0"
description = "The days a person is present in each country, reported day by day, and flagged for review as a country's days in its own tax year near or pass 183."
# What the tenant must have set up for the recipe: the steps read these by name.
[needs]
measures = ["days_present"]
# Everyone: each day is reported as a day present in each country any part
# of it has: worked there, or placed at a work location there (the
# location's values give the country). A count of 1 a day, in the measure
# days_present, by country.
[[layer]]
id = "days-present"
[[layer.step]]
id = "count"
uses = "standard/days_present"
params = { by = "country", measure = "days_present", located = true }
# The United Kingdom's tax year runs from 6 April: its 150th day present
# in it is flagged for review, and its 184th (past 183).
[[layer.step]]
id = "uk-near-183"
uses = "standard/days_present"
params = { by = "country", value = "gb", located = true, within = { every = "1y", starts = "04-06" }, days = 150, kind = "near_183_days_gb" }
[[layer.step]]
id = "uk-past-183"
uses = "standard/days_present"
params = { by = "country", value = "gb", located = true, within = { every = "1y", starts = "04-06" }, days = 184, kind = "past_183_days_gb" }
# Australia's runs from 1 July.
[[layer.step]]
id = "au-near-183"
uses = "standard/days_present"
params = { by = "country", value = "au", located = true, within = { every = "1y", starts = "07-01" }, days = 150, kind = "near_183_days_au" }

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 Sydney since March: Australia's tax year from 1 July makes Friday 27 November 2026 its 150th day present, flagged for review, though the calendar year reached 150 days in July
scenarios/australias-tax-year-from-1-july.toml
description = "In Sydney since March: Australia's tax year from 1 July makes Friday 27 November 2026 its 150th day present, flagged for review, though the calendar year reached 150 days in July"
[policy]
zone = "Australia/Sydney"
[[measure]]
id = "days_present"
kind = "count"
[[location]]
id = "sydney"
zone = "Australia/Sydney"
values = { country = "au" }
[[employment]]
effective = "2026-03-02"
kind = "hired"
location = "sydney"
[expect]
week = "2026-11-23"
exceptions = [{ kind = "near_183_days_au", at = "2026-11-23 00:00" }]
quantities = [
"2026-11-23 days_present 1 present country=au",
"2026-11-24 days_present 1 present country=au",
"2026-11-25 days_present 1 present country=au",
"2026-11-26 days_present 1 present country=au",
"2026-11-27 days_present 1 present country=au",
"2026-11-28 days_present 1 present country=au",
"2026-11-29 days_present 1 present country=au",
]
Monday and Tuesday worked in Munich, Wednesday to Friday in Paris, and the weekend spent there: each day is one day present in its country, the weekend's by the work location
scenarios/each-day-is-reported-in-each-country-it-has.toml
description = "Monday and Tuesday worked in Munich, Wednesday to Friday in Paris, and the weekend spent there: each day is one day present in its country, the weekend's by the work location"
punch = [
{ at = "2026-10-05 08:00", kind = "in" }, { at = "2026-10-05 16:00", kind = "out" },
{ at = "2026-10-06 08:00", kind = "in" }, { at = "2026-10-06 16:00", kind = "out" },
{ at = "2026-10-07 08:00", kind = "in" }, { at = "2026-10-07 16:00", kind = "out" },
{ at = "2026-10-08 08:00", kind = "in" }, { at = "2026-10-08 16:00", kind = "out" },
{ at = "2026-10-09 08:00", kind = "in" }, { at = "2026-10-09 16:00", kind = "out" },
]
[policy]
zone = "Europe/Berlin"
[[measure]]
id = "days_present"
kind = "count"
[[location]]
id = "munich"
zone = "Europe/Berlin"
values = { country = "de" }
[[location]]
id = "paris"
zone = "Europe/Paris"
values = { country = "fr" }
[[employment]]
effective = "2026-10-05"
kind = "hired"
location = "munich"
[[employment]]
effective = "2026-10-07"
kind = "changed"
location = "paris"
[expect]
week = "2026-10-05"
quantities = [
"2026-10-05 days_present 1 present country=de",
"2026-10-06 days_present 1 present country=de",
"2026-10-07 days_present 1 present country=fr",
"2026-10-08 days_present 1 present country=fr",
"2026-10-09 days_present 1 present country=fr",
"2026-10-10 days_present 1 present country=fr",
"2026-10-11 days_present 1 present country=fr",
]
In London since January: Tuesday 6 October 2026 is the 184th day present in the tax year from 6 April, past 183, and is flagged; a day worked that week flags it about its line
scenarios/past-183-days-is-flagged.toml
description = "In London since January: Tuesday 6 October 2026 is the 184th day present in the tax year from 6 April, past 183, and is flagged; a day worked that week flags it about its line"
punch = [{ at = "2026-10-06 09:00", kind = "in" }, { at = "2026-10-06 17:00", kind = "out" }]
[policy]
zone = "Europe/London"
[[measure]]
id = "days_present"
kind = "count"
[[location]]
id = "london"
zone = "Europe/London"
values = { country = "gb" }
[[employment]]
effective = "2026-01-05"
kind = "hired"
location = "london"
[expect]
week = "2026-10-05"
exceptions = [{ kind = "past_183_days_gb", at = "2026-10-06 09:00" }]
In London since January: the UK tax year starts again on 6 April, and its 150th day present, Wednesday 2 September 2026, is flagged for review
scenarios/the-150th-day-of-the-uk-tax-year-is-flagged.toml
description = "In London since January: the UK tax year starts again on 6 April, and its 150th day present, Wednesday 2 September 2026, is flagged for review"
[policy]
zone = "Europe/London"
[[measure]]
id = "days_present"
kind = "count"
[[location]]
id = "london"
zone = "Europe/London"
values = { country = "gb" }
[[employment]]
effective = "2026-01-05"
kind = "hired"
location = "london"
[expect]
week = "2026-08-31"
exceptions = [{ kind = "near_183_days_gb", at = "2026-08-31 00:00" }]
quantities = [
"2026-08-31 days_present 1 present country=gb",
"2026-09-01 days_present 1 present country=gb",
"2026-09-02 days_present 1 present country=gb",
"2026-09-03 days_present 1 present country=gb",
"2026-09-04 days_present 1 present country=gb",
"2026-09-05 days_present 1 present country=gb",
"2026-09-06 days_present 1 present country=gb",
]