Skip to content
rdlabo.devdocs

Getting Started

Timezone-aware calendar and wall-clock utilities for Cloudflare Workers. Workers execute with UTC
instants; this package lets an application select an IANA timezone once per isolate and handles DST
when converting between instants and local dates.

Try the conversion demo. We recommend pairing the library with ESLint checks to catch implicit timezone usage.

Install

npm install @rdlabo/workers-timezone

Quick start

import { TIME_ZONES, initializeTimezone, localDateTimeToInstant, toLocalDateTime } from '@rdlabo/workers-timezone';

initializeTimezone({ timeZone: TIME_ZONES.NEW_YORK });

toLocalDateTime(new Date('2026-07-01T13:00:00Z'));
// '2026-07-01 09:00:00'

localDateTimeToInstant('2026-07-01', '09:00:00');
// 2026-07-01T13:00:00.000Z

Initialize once during module evaluation, never per request or tenant. The uninitialized default
is Asia/Tokyo; pass an explicit timezone to conversions for user-specific behavior.

Documentation

  • Timezones and calendar dates — configuration, DST, and database boundaries.
  • API — conversions, calendar operations, types, and compatibility names.
  • Migration — moving from the kit and behavior changes.

These guides describe this source revision. Use the matching release tag for an installed version.