Library API
    Preparing search index...

    Function getCountryFromTimeZone

    • Deduces an ISO 3166-1 alpha-2 country/region code from an IANA time zone identifier using Intl.Locale.prototype.getTimeZones() and Intl.DateTimeFormat canonicalization.

      Parameters

      • OptionaltimeZone: string

        IANA time zone identifier (e.g. 'America/New_York', 'US/Eastern')

      • Optionalregions: readonly string[]

        Optional candidate ISO 3166-1 alpha-2 region codes to index

      Returns string | undefined

      Uppercase ISO region code (e.g. 'US'), or undefined for neutral/unknown zones (e.g. 'UTC')