Skip to content

getZonedWeekOfYear

getZonedWeekOfYear(ianaTimezone: string): number | null

Return the current week of year for the specified IANA timeZone.

  • Uses Temporal.Now.zonedDateTimeISO to get the current time.
  • Uses Temporal.PlainDate.weekOfYear for ISO week number.
  • Validation is performed on the timezone.
ParameterTypeDescription
ianaTimezonestringIANA name or UTC offset: a time zone identifier (+05:30, +0530, -08) or a stored offset (±HH:MM[:SS], what getTimeZoneOffset returns)

current week number (1-53) or null on invalid input

import { getZonedWeekOfYear } from "@northguild/gmt/zoned/get";
getZonedWeekOfYear("America/New_York") // 9
output 

zoned/get/getZonedWeekOfYear.ts