Get the UTC Offset for a Timezone in JavaScript

To get a zone's UTC offset at a moment, build a Temporal.ZonedDateTime in that zone and read .offset ('-04:00') or .offsetNanoseconds. Part of Timezone Offset Math Explained.

Why this scenario is tricky

An offset is not a property of a zone — it is a property of a zone at an instant, because DST moves it twice a year. Asking "what is New York's offset" is meaningless without a date; America/New_York is -05:00 in January and -04:00 in July. Read the offset off a zoned instant, not a lookup table.

Offset depends on the instantA zone has no single fixed offsetOffset depends on the instanthard-code NY = -05:00wrong half the yearzdt.offset at that instantDST-correctThe offset changes with DST, so read it for a specific moment.

Minimal working solution

import { Temporal } from '@js-temporal/polyfill';
const zdt = Temporal.Now.instant().toZonedDateTimeISO('America/New_York');
zdt.offset; // '-04:00' or '-05:00' depending on the date

Offset nowZoned instant exposes .offsetOffset nowinstant+zone.offset'-04:00'

Full production version

import { Temporal } from '@js-temporal/polyfill';
function offsetAt(instant: Temporal.Instant, zone: string) {
  const z = instant.toZonedDateTimeISO(zone);
  return { text: z.offset, minutes: z.offsetNanoseconds / 60e9 };
}

Offset at an instantReturn the string and minutesOffset at an instantinstant+zonetoZonedDateTimeISOoffset(Ns)text+minutes

Verification snippet

UTC Offset for a Timezone assertionsKey cases assert correctlyAssertions that prove the edge caseNY in January-05:00NY in July-04:00Kolkata+05:30offsetNanosecondsnumeric

Common pitfalls

UTC Offset for a Timezone pitfallsCommon mistakes and their fixesWrongRighthard-code one offsetwrong across DSTzdt.offset at the instantDST-correctgetTimezoneOffset() signinverted, host-onlyoffsetNanosecondsexact numeric

Frequently Asked Questions

How do I get the UTC offset of a time zone in JavaScript?

Build a Temporal.ZonedDateTime for the instant you care about in that zone and read its offset ('-04:00') or offsetNanoseconds. The offset must be tied to an instant because daylight saving changes it during the year.

Why can't I store a single UTC offset for a time zone?

Because a zone has different offsets at different times — New York is -05:00 in winter and -04:00 in summer — so a stored number goes stale at the next DST transition. Store the IANA identifier and compute the offset per instant.