Skip to content

getFiscalPeriod

  • The core functions, which every industry uses.
getFiscalPeriod(value: string, calendar: FiscalCalendar): { year: number; period: number; week: number; } | null

Return the fiscal year, period and week value falls in, for a 52/53-week retail calendar.

  • 52 × 7 is 364 days, so a 52-week fiscal year drifts a day or two against the sun every year and a 53rd week is inserted every five or six to pull it back. Both the drift and the insertion fall out of calendar — nothing here is bundled, because there is no single correct retail calendar.
  • calendar.pattern is the weeks-per-period shape of a quarter: "4-5-4", "4-4-5" or "5-4-4". Four quarters of 13 weeks make the 52-week year.
  • calendar.yearEndsOn states the year-end rule, by example, not one year’s end. Fiscal years end on that date’s weekday, on the occurrence nearest that date’s month and day. One published 4-5-4 example (NRF, US) adds a 53rd week when “there are four or more days left in January” (NRF 4-5-4 calendar), which puts its year end on the Saturday nearest January 31. As yearEndsOn that is "2026-01-31", a Saturday falling exactly on January 31. Passing a published year end from a 53-week year instead ("2024-02-03") states a different rule, because that date sits three days off the target the rule is centred on, and yields a different, self-consistent calendar.
  • IFRS 18 ¶29 (formerly IAS 1 ¶37; IFRS 18 applies to reporting periods beginning on or after 2027-01-01) does not preclude reporting for a 52-week period, and a 53-week year follows from it. No international standard says where the 53rd week goes or which calendar year names the fiscal year, and published calendars disagree on both. So calendar.extraWeek and calendar.yearLabel are required, and there is no default.
  • calendar.extraWeek is the period a 53rd week is added to: "firstPeriod" (ONS, UK: “a five week January”) or "lastPeriod" (NRF, US: “to the end of the calendar”).
  • calendar.yearLabel names the fiscal year: "startYear" (NRF, US), "endYear", the year its last day falls in, or "majorityYear", the calendar year holding the most days (ONS, UK). IFRS 18 ¶27(c) (formerly IAS 1 ¶51(c)) lets a reporting period be identified by the date it ends, which supports "endYear". GMT rule: a 182/182 split goes to the end year, for the same reason.
  • year is not a unique key for every year end. A 364- or 371-day year drifts against the calendar, so every label rule has year ends where two fiscal years share a label and a calendar year names none. "startYear" and "endYear" do this for year ends near 1 January. Under yearEndsOn: "2022-12-31" with "startYear", two fiscal years both start in 2023, and 2020, 2025 and 2031 name none. "majorityYear" does it for year ends near 1 July. Under yearEndsOn: "2026-07-01", 2025-07-03 to 2026-07-01 and 2026-07-02 to 2027-06-30 are both 2026. If your rule falls in such a window, key on the fiscal year’s start date, not on year.
  • A yearEndsOn month-day that does not exist in a year follows Temporal’s overflow: "constrain": a February 29 rule reads February 28 in common years. A rule tied to the end of a month (the weekday nearest to, or last in, the month’s final days) would put a February 28 anchor on February 29 in leap years; this does not — state such a rule with a date that exists every year.
  • Whether a fiscal year has 52 or 53 weeks is derived from the gap between its own two ends, never assumed from a table.
  • value must be zoneless — an ISO date or datetime, as isValidIsoDateLike accepts. See getIsoWeekDate for why a moment is not accepted here.
  • Every date Temporal accepts gets a value, even when its fiscal year runs past -271821-04-19 or +275760-09-13. The year, period and week are calendar arithmetic, and no date of the fiscal year is returned.
  • Returns null on invalid input: a value that is not a zoneless ISO date, or a calendar that is an array or has a missing or unrecognised field. Both share the sentinel, so check the calendar with isValidFiscalCalendar first to tell the two apart.
ParameterTypeDescription
valuestringzoneless ISO 8601 date or datetime string (e.g. “2024-06-15”)
calendarFiscalCalendar{ pattern, yearEndsOn, extraWeek, yearLabel }, all required

{ year, period, week }, or null on invalid input

Members

MemberTypeDescription
yearnumberThe calendar year that names the fiscal year, chosen by calendar.yearLabel.
periodnumberThe period of the fiscal year, 1 through 12. Each period is four or five weeks long as calendar.pattern sets, and a 53rd week belongs to period 1 or period 12, as calendar.extraWeek says.
weeknumberThe week of the fiscal year, 1 through 52, or 53 in a year with an inserted week. Week 1 starts on the fiscal year’s first day.
import { getFiscalPeriod } from "@northguild/gmt/calendar/calculate";
getFiscalPeriod("2024-06-15", { pattern: "4-5-4", yearEndsOn: "2026-01-31", extraWeek: "lastPeriod", yearLabel: "startYear" }) // { year: 2024, period: 5, week: 19 }
output 

calendar/calculate/getFiscalPeriod.ts

Accessibility
© 2026 NorthGuild · Licences

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.