Functional Weave
Code in TypeScript

dates.uk-tax-year@1.0.0

README.md

1,299 bytes · view raw

# dates.uk-tax-year

The UK personal tax year runs 6 April to 5 April inclusive - a survival of the
1752 switch to the Gregorian calendar, when eleven days were dropped and the
Treasury moved year end rather than lose the revenue.

The 6 April boundary is where implementations go wrong, so the vectors pin both
sides of it. A test written as month >= 4 puts 1-5 April in the wrong tax year.
A test written against 1 April is testing the company financial year end, which
is a different thing that happens to be five days earlier, and mixing the two
moves everybody's year by a working week.

"end" is inclusive: 5 April is the last day that belongs to the year, not the
first day of the next. That is the opposite convention to
dates.business-days-between, which is half-open, and it is deliberate - a tax
year is quoted to the public as "to 5 April", and a capability that quietly
returned 6 April would be reformatted into an off-by-one on every payslip that
printed it.

The label is HMRC's own two-digit form, zero-padded, so 1999/00 and 2000/01 come
out right instead of 1999/0.

The rule is one boundary that has not moved since 1800, so it is a constant here
rather than a data file. If Parliament ever moves it, that is a dated rules
table and a new major version, not an edit to this one.