Library API
    Preparing search index...

    Function getISOWeekOfYear

    • Polyfill fallback for ISO 8601 Week of Year and Year of Week calculations.

      Introduced because highly experimental native browser implementations of the Temporal API (e.g., Chrome/Firefox behind flags) currently return undefined for weekOfYear and yearOfWeek on ZonedDateTime objects. The TC39 spec moved toward calendar-dependent definitions, causing divergence between the @js-temporal/polyfill (which returns numbers) and native browsers (which return undefined).

      Parameters

      • zdt: input

        The ZonedDateTime or matching input object

      Returns result

      An object containing the weekOfYear and yearOfWeek

      const { weekOfYear } = getISOWeekOfYear(Temporal.Now.zonedDateTimeISO());