Epoch Input

Epoch Input is a copy-paste React component that stops timestamp saved as year 57754 before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/epoch-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 3 extra npm packages
  • A11y guidance in docs

StopsTimestamp saved as year 57754

Was this component page useful?

How do I install Epoch Input?

pnpm dlx shadcn@latest add @bollard/epoch-input

The files land in your project. They're yours to edit.

How do I use Epoch Input in React?

epoch-input-usage.tsx
import { EpochInput } from "@/components/ui/epoch-input"

return <EpochInput label="Trial ends at (Unix seconds)" unit="s" defaultValue="1760400000000" timeZone="Asia/Kolkata" now={Date.UTC(2025, 9, 10)} />

What input mistakes does Epoch Input catch?

  • Milliseconds where seconds belong (and micro/nanoseconds)
  • Excel serial dates, Windows FILETIME and .NET ticks
  • ISO strings with no time zone, which JavaScript and servers read differently
  • Date-only strings read as UTC midnight
  • Impossible dates (30 Feb) and values outside 32-bit range when int32 is set

What props does Epoch Input accept?

EpochInput props
PropTypeDefault
value

Controlled text.

string—
defaultValue

Initial text when uncontrolled.

string""
onValueChange

Called with the text on every edit or fix.

(value: string) => void—
onTimestampChange

Called with the instant it reads as, in ms, or null when it can't be read.

(ms: number | null) => void—
unit

The unit the field stores. A value in another unit is flagged with a one-tap conversion.

EpochUnit—
range

Years a real value falls in. Defaults to 1970–2100.

[number, number]—
int32

Flag values a signed 32-bit time can't hold (after 19 Jan 2038 03:14:07 UTC).

boolean—
timeZone

Time zone to read the value back in. Defaults to the device's.

string—
locale

Locale for dates.

string"en-GB"
now

Clock for "in 3 days" and for picking the likeliest unit, in ms. Defaults to the time the component mounted.

number—
label

Visible label; shorthand for `messages.label`.

string—
messages

Every visible string. `{found}`, `{expected}`, `{asIs}` and the other placeholders are filled in.

Partial<EpochInputMessages>—

* required. Also accepts the native props of <input> (className, aria-*, data-*…), passed through to it.

How is Epoch Input accessible?

  • Visible <label>; aria-invalid and aria-describedby to the readback
  • After a fix, focus moves to the next fix or back to the input
  • Motion respects prefers-reduced-motion

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Unit guesses rely on plausible ranges; very old or far-future dates can be misread
  • Time zones come from the browser's Intl data

What expensive mistakes does Epoch Input stop?

Timestamp saved as year 57754

Also known as

unix timestamp · epoch · epoch converter · milliseconds · iso 8601 · utc · date-fns · created_at

What dependencies does Epoch Input require?

Epoch Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameEpoch Input
Registry identifier@bollard/epoch-input
Install commandnpx shadcn@latest add @bollard/epoch-input
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencies@date-fns/tz, lucide-react, motion
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Epoch Input

What form validation mistake does Epoch Input catch?

Epoch Input prevents timestamp saved as year 57754. Reads a timestamp back as a date in your zone and UTC and catches unit mix-ups, so a value isn't saved as year 57,754 or the wrong hour. Catches: Milliseconds where seconds belong (and micro/nanoseconds), Excel serial dates, Windows FILETIME and .NET ticks, ISO strings with no time zone, which JavaScript and servers read differently, Date-only strings read as UTC midnight, Impossible dates (30 Feb) and values outside 32-bit range when int32 is set. Limitation: validate epoch-input schemas on backend.

How do I install epoch-input with shadcn?

Run `npx shadcn@latest add @bollard/epoch-input`. Sources added: registry/default/epoch-input/epoch-input.tsx, registry/default/epoch-input/epoch.ts. Package requirements: @date-fns/tz, lucide-react, motion.

What props customize Epoch Input?

Epoch Input accepts `value`, `defaultValue`, `onValueChange`, `onTimestampChange`, `unit`. Configures unix timestamp, epoch, epoch converter behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of epoch-input?

Unit guesses rely on plausible ranges; very old or far-future dates can be misread. Time zones come from the browser's Intl data Server requirement: backend verification for epoch-input.

How does Epoch Input meet accessibility guidelines?

Visible <label>; aria-invalid and aria-describedby to the readback. After a fix, focus moves to the next fix or back to the input. Motion respects prefers-reduced-motion. Minimizes errors: milliseconds vs seconds timestamp, unix time shows 1970.

Which components pair with Epoch Input?