@vielzeug/timit
v2.0.0
Published
> Temporal-powered date and time utilities for modern TypeScript apps.
Downloads
56
Readme
@vielzeug/timit
Temporal-powered date and time utilities for modern TypeScript apps.
@vielzeug/timit provides ergonomic, type-safe helpers for the Temporal API: parsing, timezone conversion, date-time arithmetic (with DST safety), range checks, and formatting.
Installation
pnpm add @vielzeug/timit
# npm install @vielzeug/timit
# yarn add @vielzeug/timitQuick Start
import { d } from '@vielzeug/timit';
const meeting = '2026-03-21T10:30:00Z';
const meetingNY = d.asZoned(meeting, { tz: 'America/New_York' });
const reminder = d.add(meetingNY, { minutes: -15 });
console.log(d.format(reminder, { pattern: 'short', locale: 'en-US', tz: 'America/New_York' }));Or use individual imports:
import { add, format, asZoned } from '@vielzeug/timit';
// same code, just without the "d." prefixAPI Quick Reference
Conversion
asInstant(input, options?)— Normalize to canonical timeline valueasZoned(input, options?)— View time in a specific timezone
Arithmetic
add(input, duration, options?)— Add duration (DST-safe)subtract(input, duration, options?)— Subtract duration (DST-safe)diff(start, end, options?)— Compute duration between two times
Queries
now(tz?)— Current time in timezonewithin(value, start, end, options?)— Check if time is in range
Formatting
format(input, options?)— Format as string with'short' | 'long' | 'iso' | 'date-only' | 'time-only'formatRange(start, end, options?)— Format time span with browserIntl.formatRangefallback
Exports
Temporal(from@js-temporal/polyfill) for advanced use
Why timit?
✅ Temporal-safe: No fragile Date arithmetic or timezone math
✅ DST-aware: Handles daylight-saving transitions correctly
✅ Intl-integrated: Locale formatting without boilerplate
✅ Concise API: Short, intuitive function names
✅ Polyfilled: Works in runtimes without native Temporal
License
MIT © Helmuth Saatkamp — part of the Vielzeug monorepo.
