Skip to content

getWeekYear

  • The core functions, which every industry uses.
getWeekYear(value: string): number | null

Return the ISO 8601 week-numbering year value belongs to.

  • Distinct from value’s calendar year — late-December/early-January dates can belong to a different ISO week-year than their calendar year (e.g. 2024-12-30 is a Monday in ISO week 1 of 2025). Pair this with weekOfYearForDate when bucketing by week: a week number alone is ambiguous without the week-year it belongs to.
  • Uses Temporal.PlainDate.yearOfWeek (ISO weeks: Monday-start, week 1 contains the year’s first Thursday).
  • Returns null on invalid input.
ParameterTypeDescription
valuestringISO PlainDate string

ISO week-numbering year, or null on invalid input

import { getWeekYear } from "@northguild/gmt/plain/calculate";
getWeekYear("2024-06-15") // 2024
output 

plain/calculate/getWeekYear.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.