DateTz Playground

A live test bench for @open-rlb/date-tz

World Clock

Live times across the globe, rendered with DateTz.now(tz).toString(). Updated every second.

Your local time
—
—
Unix timestamp (ms)
—
—

Timestamp → DateTz

Build a DateTz from a Unix timestamp and inspect every getter.

Parse string → DateTz

Invokes DateTz.parse(dateString, pattern, tz).

Format DateTz → string

Calls date.toString(pattern, locale). Experiment with the full token set.

Format tokens reference

toString and parse share one vocabulary. The last column says what parse does with each token reading the string back.

TokenMeaningRead back by parse
YYYY / yyyyFull yearyes
YY / yy2-digit yearyes, as 1970–2069
MMMonth 01–12yes
LMLong month name (locale)no — throws
SMShort month name (locale)no — throws
DDDay of month 01–31yes
HHHour 00–23yes
hhHour 01–12 (needs aa/AA)yes
mmMinuteyes
ssSecondyes
aa / AAam/pm — AM/PMyes
WLLong weekday namematched, ignored
WSShort weekday namematched, ignored
tzTimezone identifiermatched, ignored

Month names need the locale they were written in, which parse is not given, so it throws rather than guess at a language — use MM for anything you intend to read back. parse matches the string from its first character: separators are literal and numbers must be padded, but anything past the last token is ignored, so an ISO value like 2026-08-13T13:45:30.123Z reads fine against YYYY-MM-DD HH:mm:ss. The T and a space are interchangeable as the date/time separator; a zone suffix is skipped, not honoured.

Cross-timezone view (cloneToTimezone)

One absolute instant, experienced by readers in different timezones.

Manipulate

Chain add / set operations and watch the timestamp evolve.

Time units (millisecond, second, minute, hour) move the instant — an hour is always 3600 seconds. Calendar units (day, month, year) move the local wall clock, so adding a day keeps the clock time even when a DST transition makes that day 23 or 25 hours long. Try 2025-03-29 12:00:00 in Europe/Rome: add(1, 'day') lands on 12:00, add(24, 'hour') on 13:00. Months and years clamp to the end of the target month — 31 January plus one month is 28 February. set assigns the component a reader in that timezone would see.

    Timezone data

    Where the offsets on this page actually come from — and how exceptions correct them when they are stale.

    DateTz ships no timezone data of its own. Offsets are read from your browser's copy of the IANA database, so what you see here depends on your browser, not on the version of the library. When a country changes its rules, a browser that has not been updated keeps returning the old offset. TzExceptions states the new rule directly: the default provider consults it before the browser, so every panel on this page follows a registered exception.

    Registered exceptions

    Printed by TzExceptions.toString(). Morocco (20 September 2026, permanent UTC+0, Western Sahara included) and British Columbia (1 November 2026, permanent UTC-7) come preloaded. Ranges read as intervals — [ includes its bound, ) excludes it — and instants are in UTC.

    —

    Your browser versus the exceptions

    For each exception, the offset your browser's own database reports at an instant the exception covers, next to what DateTz resolves. A browser that disagrees is stale; the exception wins either way.

    —

    Register an exception

    offset is in minutes east of UTC, signed. Bounds are UTC: from is included, to excluded, and leaving one empty leaves that side open. Exceptions for the same zone may not overlap — unregister the zone first to replace one.

    —