Date Format — the AtomForge character at work

@atom-forge/date-format · Presentation

Format dates. Nothing more.

Date Format uses the runtime’s Intl.DateTimeFormat support to display dates through a small token interface. It is built for presentation, not for date arithmetic or parsing user input.

TypeScript Intl Locale Timezone

What it is

A formatter, not a date engine.

dateFormat(format, date?, lang?, timeZone?) returns a string. The date defaults to now and the language to en-GB; pass a timezone when the output must not depend on the viewer’s location.

Percent tokens produce numbers (%Y, %M, %D, %H, %I, %S) and dollar tokens produce localized names (month, weekday, day period, timezone).

Why choose Date Format?

Native locale data

Month names, weekdays and timezone labels come from Intl, so they follow the locale you ask for.

Compact tokens

A short format string replaces a chain of option objects.

Explicit timezone

Fix the instant, locale and zone, and the output is reproducible.

How it works

  1. Store an instant

    Keep an unambiguous timestamp; format only when you present it.

  2. Choose locale and zone

    Use the same values on the server and the client to avoid hydration differences.

  3. Write the format

    Combine numeric and text tokens, for example %Y-%M-%D or $D, %D $M %Y.

An honest fit check

Trade-offs, not fine print

Tokens are its own

They are not Moment-style YYYY or date-fns patterns. %M is the padded month; use %I for minutes.

Output depends on the runtime

Localized names and punctuation vary with the runtime’s Intl data, so avoid brittle tests on them.

In practice

A fixed instant, locale and timezone

A fixed timestamp and timezone make the numeric output reproducible.

TypeScript · Illustrative · adapted from the source texts; package API not verified here
import { dateFormat } from '@atom-forge/date-format';

const instant = new Date('2026-04-07T06:05:03Z');
const zone = 'Europe/Budapest';

dateFormat('%Y-%M-%D', instant, 'en-GB', zone); // 2026-04-07
dateFormat('%H:%I:%S', instant, 'en-GB', zone); // 08:05:03