v144 · JavaScript · demo
Time Zone Converter
Convert moments between any two IANA time zones using Temporal.ZonedDateTime.
Detects DST gaps and folds, shows current UTC offsets, and walks forward to find the next
offset transition — all without a single library.
source
target
next UTC offset transition in source zone
the API
// Convert a wall-clock time from one zone to another
const src = Temporal.ZonedDateTime.from({
timeZone: 'America/New_York',
year: 2026, month: 3, day: 8,
hour: 2, minute: 30 // could be in the DST gap!
});
const target = src.withTimeZone('Europe/Berlin');
console.log(target.toString());
// → 2026-03-08T08:30:00+01:00[Europe/Berlin]
// Detect a DST gap (spring forward)
const earlier = src.with({}, { disambiguation: 'earlier' });
const later = src.with({}, { disambiguation: 'later' });
if (!Temporal.ZonedDateTime.compare(earlier, later)) {
console.log('No gap — time exists unambiguously');
} else {
console.log('Gap or fold detected');
}
// Get UTC offset as a string
console.log(src.offsetNanoseconds / 1e9 / 3600 + 'h');
why Temporal beats Date
The legacy Date API stores only a UTC millisecond count and relies on the
system locale for time zone arithmetic — you cannot ask it "what is 2:30 AM in
New York expressed in Berlin time" without manually computing offsets via
Intl.DateTimeFormat hacks. Temporal.ZonedDateTime keeps the IANA zone
name attached to the value, performs all calendar arithmetic correctly across DST boundaries,
and lets you explicitly choose disambiguation behaviour when a wall-clock time is ambiguous or
does not exist.
see also
- Temporal in ECMA-262 — feature index
- Temporal Walkthrough — add durations, compare Date vs Temporal
- Duration Arithmetic — add, subtract, round durations
- Calendar Explorer — non-Gregorian calendars
- Temporal proposal docs
- ChromeStatus entry