@tremendous/help
    Preparing search index...

    Function timezoneName

    • Returns the system timezone abbreviation for a given locale, like "EST", "PST", "UTC". If no locale is passed, it will consider the browser's default locale, like "en-US". So, "America/New_York" timezone will return "EST" or "EDT" for "en-US" locale.

      In case the timezone does not have a local name in that locale, like "America/New_York" timezone being seen by a person in "en-GB" (England), it will return the GMT offset, "GMT-4" in this case.

      Read more: https://github.com/tc39/proposal-temporal/issues/2257#issuecomment-1152070209 Timezone abbreviations: https://github.com/unicode-org/icu/blob/main/icu4c/source/data/zone/tzdbNames.txt

      Parameters

      • locale: LocalesArgument = ...

        A string in a format like "en-US".

      • OptionalforceTimeZone: string

        timezone string like "America/New_York"

      • Optionaldate: Date

        The date to use for determining daylight saving time. If not provided, uses the current date.

      • timeZoneNameFormat:
            | "short"
            | "long"
            | "shortOffset"
            | "longOffset"
            | "shortGeneric"
            | "longGeneric"
            | undefined = "short"

      Returns string

      "EST", "PST", "UTC", "GMT-4", etc.

      timezoneName("en-US"); // "EST" or "EDT" depending on current date
      timezoneName("en-US", undefined, new Date("2021-08-10")); // "EDT" (summer)
      timezoneName("en-GB"); // "GMT-4" or "GMT-5" depending on DST