Functional Weave
Code in Rust

hr.length-of-service@1.0.0

README.md

1,362 bytes · view raw

# hr.length-of-service

Continuous service from a start date to an end date, as completed years,
months and days. Statutory rights hang off these numbers (one month for notice,
two years for redundancy pay and unfair dismissal), so the boundary matters.

**Both dates count.** Someone who starts on 1 January 2024 and whose last
counted day is 31 December 2025 has exactly 2 years, not 1 year 11 months and
30 days. Internally the end is moved to the next day and the calendar
difference is taken from there, which is how the Employment Rights Act 1996
s.211 frames a period of continuous employment: it begins with the day the
employee starts work and ends with the day in question.

**Month ends.** A month is completed when the same day-of-month comes round
again; a start on the 29th, 30th or 31st uses the last day of a shorter month
instead (dates.add-months clamps: 31 January plus one month is 28 February).
So 31 January to 27 February inclusive is one whole month: every day of
February up to its 28th day is covered. Callers with a contractual rule for
these starts should apply it themselves.

This does not decide whether service was continuous (breaks, TUPE transfers,
strikes and the ERA 1996 Part XIV rules); it measures the period it is given.

Source: Employment Rights Act 1996 s.211,
https://www.legislation.gov.uk/ukpga/1996/18/section/211.