Skip to content

getZonedIn

getZonedIn(timeZone: string, units: Partial<Record<keyof DurationLike, number>>): string

Return the zoned datetime after now in timeZone, counted from the current time.

  • Zone first, as getZonedNow. An invalid zone, or an offset with seconds (-00:44:30), returns "": a written zone cannot carry seconds (RFC 9557 §4.1).
  • Reads the clock once, after units is checked.
  • units is an object of unit amounts, such as { days: 90 }. A duration string returns "". A fractional amount returns "": write { days: 1, hours: 12 } for a day and a half, which keeps the day on the wall clock across a clock change.
  • Lengths are unsigned: a negative amount returns "". getZonedAgo is the way back.
  • { days: 0 } is a valid length and gives now.
  • Calendar units count on timeZone’s wall clock, and a missing day clamps to the end of the month, as addZoned does. A result in a gap moves later and one on a repeated time takes the earlier ("compatible", LOCAL_TIME_RESOLUTION), unless the length has no date part, which counts exact time.
  • Whole seconds, floored. For sub-seconds, write addZoned(getZonedNow(timeZone, { smallestUnit: "nanosecond" }), units).
  • The pinned route, which also fixes the start, is addZoned(getZonedNow(timeZone), units).
  • Examples read the clock at 2027-06-15T12:00:00Z.
ParameterTypeDescription
timeZonestringIANA name or a UTC offset to the minute (what isValidTimeZone accepts)
unitsPartial<Record<keyof DurationLike, number>>unit amounts, such as { days: 90 }; never negative

zoned ISO 8601 datetime string in whole seconds, or "" for an invalid zone or units, a negative amount or a result outside Temporal’s range

import { getZonedIn } from "@northguild/gmt/zoned/get";
getZonedIn("Asia/Tokyo", { days: 90 }) // "2027-09-13T21:00:00+09:00[Asia/Tokyo]" (90 days out, 21:00 in Tokyo)
output 

zoned/get/getZonedIn.ts

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else:© 2026 NorthGuild, all rights reserved.