Skip to content

getZonedDayOfWeek

getZonedDayOfWeek(ianaTimezone: string): number | null

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

  • Uses Temporal.Now.zonedDateTimeISO to get the current time.
  • Returns 1-7 (Monday=1 through Sunday=7).
  • 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 day of week number (1-7) or null on invalid input

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

zoned/get/getZonedDayOfWeek.ts