Skip to content

getIsoWeekDate

getIsoWeekDate(value: string): { year: number; week: number; weekday: number; } | null

Return the ISO 8601 week date — week-numbering year, week and weekday — for value.

  • Vessel schedules, production plans and retail reports are published by week number, and a week number alone is ambiguous: the week-numbering year is not the calendar year at either end of a year, so all three fields come back together rather than as three calls a caller could combine inconsistently.
  • A week-numbering year has 53 weeks roughly every five to six years, and 52 otherwise.
  • value must be zoneless — an ISO date or datetime, as isValidIsoDateLike accepts. An offset, a Z or a bracketed zone makes it a moment rather than a calendar date; convert it in the zone you mean first (convertUtcToZoned then convertZonedToPlainDateTime), or floor it with floorToZone.
  • Returns null on invalid input.
ParameterTypeDescription
valuestringzoneless ISO 8601 date or datetime string (e.g. “2024-06-15”)

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

Members

MemberTypeDescription
yearnumberThe ISO 8601 week-numbering year: the calendar year that holds the Thursday of the date’s week. It differs from the date’s own calendar year for some dates in late December and early January.
weeknumberThe ISO 8601 week number, 1 through 53. Week 1 is the week that holds the year’s first Thursday, and weeks start on Monday.
weekdaynumberThe ISO 8601 day of the week, 1 (Monday) through 7 (Sunday).
import { getIsoWeekDate } from "@northguild/gmt/calendar/calculate";
getIsoWeekDate("2024-06-15") // { year: 2024, week: 24, weekday: 6 }
output 

calendar/calculate/getIsoWeekDate.ts