Date/time

Day.js Date/Time Playground

Check Day.js formats, strict parsing, localized output, local vs UTC behavior and relative time before the date contract lands in code.

  • Input stays in the browser
  • Local and UTC comparison
  • Explicit plugin setup

Date formatting without guessing

Day.js is small, familiar and plugin driven, but production bugs often come from the small details: a missing customParseFormat plugin, a locale applied globally, a UTC timestamp rendered as local time or a format token that looks right but describes the wrong contract. This playground keeps those decisions visible.

The evaluator runs in the browser. The page does not send pasted dates, formats or snippets to a backend and does not store history.

Format and parse with Day.js

Choose a preset, adjust the input, parse format, output format, locale and mode, then compare local, UTC, localized and relative output.

Local

Start from an ISO timestamp and inspect a common dashboard format.

Input contract

Day.js output

Formatted
2026-05-26 09:30:00
ISO output
2026-05-26T09:30:00.000Z
Unix ms
1779787800000

Local output

2026-05-26 09:30:00

Uses the runtime/browser local timezone.

UTC output

2026-05-26 09:30:00

Parses and formats through dayjs.utc(...).

Localized output

Tuesday, May 26, 2026 9:30 AM

Uses the selected locale on the value instance.

Relative time

a few seconds ago

Computed from the deterministic referenceNow field.

Active plugins

  • customParseFormat
  • utc
  • localizedFormat
  • relativeTime
  • advancedFormat

Review notes

  • No custom parse format is active; Day.js uses its standard parser for this input.
  • Local mode uses the browser/runtime timezone. Compare with UTC before using the value in API payloads.

Reproducible snippet

import dayjs from 'dayjs';
import customParseFormat from 'dayjs/plugin/customParseFormat';
import utc from 'dayjs/plugin/utc';
import localizedFormat from 'dayjs/plugin/localizedFormat';
import relativeTime from 'dayjs/plugin/relativeTime';
import advancedFormat from 'dayjs/plugin/advancedFormat';

dayjs.extend(customParseFormat);
dayjs.extend(utc);
dayjs.extend(localizedFormat);
dayjs.extend(relativeTime);
dayjs.extend(advancedFormat);

const value = dayjs("2026-05-26T09:30:00Z").locale("en");
const output = value.format("YYYY-MM-DD HH:mm:ss");

What to verify before shipping date code

Format tokens

Tokens such as YYYY, MM, DD, HH, mm, ss, Z, dddd and LLL communicate a contract. Keep the intended output visible before copying it into API docs, UI labels or release scripts.

Local vs UTC

A timestamp with Z can look different in local mode than in UTC mode. Compare both before using a value in payloads, logs or release notes.

Locale and plugins

Day.js locales and plugins are explicit. This playground shows customParseFormat, utc, localizedFormat, relativeTime and advancedFormat so the snippet does not hide setup work.

Date strings often travel through formatted code and JSON payloads. Use the neighboring tools when the contract is broader than one Day.js expression.

FAQ

Does this include full IANA timezone conversion?

No. The MVP is intentionally scoped to local vs UTC and locale output. A full timezone lab would be a separate product.

Why is referenceNow editable?

Relative time must be reproducible. A fixed reference date makes tests, docs and review comments deterministic.

Does the page change Day.js global locale?

No. The evaluator applies locale on the Day.js instance so tests and SSR requests do not inherit a hidden global locale.

Is this a replacement for repository tests?

No. Use it to inspect a date contract, then keep final parsing and formatting behavior covered in normal unit tests.