Functional Weave
Code in TypeScript

education.academic-year@1.0.0

README.md

1,326 bytes · view raw

# education.academic-year

Which academic year a date falls in (label, first and last day), and which of
the caller's terms, if any, contains it.

## Decisions

- **The year runs from `yearStart` to the day before the next one.** With
  `null` it is 1 September to 31 August, the academic year the Department for
  Education uses in England for school years, admissions and statistics. Pass
  `08-01` for a year that starts in August (Scottish schools, many
  universities), or whatever your institution uses.
- **Term dates are arguments, not data.** Every local authority, academy
  trust and university sets its own, so there is nothing the registry could
  carry that would be right. A date between terms is in the academic year but
  in no term: `term` is null.
- A term is found by date alone, so it need not lie inside the academic year
  (a university's September welcome week before a `10-01` year start still
  resolves). Overlapping terms are refused, since a date would be in two.
- The label is `2025/26`, with the second year as two digits (`1999/00`); a
  year starting on 1 January is one calendar year and is labelled `2026`.
- `yearStart` must be a day every year has, so `02-29` is refused. A
  `03-01` start ends on 29 February in a leap year: the end is the day
  before the next start, not a fixed date.