Skip to content

weekOfYearForDateTime

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

Return the ISO week number for a given ISO 8601 datetime string.

  • Uses Temporal.PlainDate.weekOfYear (Monday-based ISO weeks).
  • Returns null for invalid input.
ParameterTypeDescription
valuestringISO 8601 datetime string

Week number (1-53) or null on invalid input

import { weekOfYearForDateTime } from "@northguild/gmt/plain/calculate";
weekOfYearForDateTime("2024-01-01T12:00:00") // 1
output 

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