Skip to content

formatCalendarUtc

formatCalendarUtc(value: string, locale?: string, options?: FormatCalendarUtcOptions): string
import { formatCalendarUtc } from "@northguild/gmt/utc/format";

Format a UTC ISO string as a relative day label plus time-of-day, e.g.

  • “Tomorrow at 2:30 PM” — the UTC counterpart of formatCalendar. See that function’s JSDoc for the day-label/threshold/connector design; this variant compares calendar days and renders the clock time in timeZone (default "UTC").
Parameter Type Description
value string UTC ISO string to format
locale string optional: BCP 47 locale tag

options

Option Type Default
reference? string
timeZone? string
timeStyle? "short" | "medium" | "full"

the formatted calendar string, or “” on invalid input

formatCalendarUtc("2026-03-16T18:30:00Z", "en-US", { timeZone: "America/New_York", reference: "2026-03-15T13:00:00Z" }) // "tomorrow at 2:30 PM"
formatCalendarUtc(value, "fr-FR", { timeZone: "Europe/Paris" }) // "demain à 14:30"
formatCalendarUtc("not-a-date") // ""

utc/format/formatCalendarUtc.ts