Skip to content

FormatRelativeZonedOptions

The FormatRelativeZonedOptions type.

import type { FormatRelativeZonedOptions } from "@northguild/gmt/zoned/format";
Member Type Description
style? "long" | "short" | "narrow"
numeric? "always" | "auto"
largestUnit? RelativeUnit
roundingMethod? RelativeRoundingMethod
reference? string | number
interface FormatRelativeZonedOptions {
style?: "long" | "short" | "narrow";
numeric?: "always" | "auto";
largestUnit?: RelativeUnit;
/**
* How the computed distance rounds to the display unit: "floor" rounds toward the
* earlier boundary, "ceil" toward the later boundary, "round" (default) to the nearest —
* matches current behavior when omitted.
*/
roundingMethod?: RelativeRoundingMethod;
/**
* Anchor point for the relative diff.
*
* - ZonedDateTime ISO string: kept in its own zone; Temporal handles
* cross-zone diffs correctly. The label is therefore zone-aware — a value
* and reference in different zones can produce a non-zero diff even when
* they describe the same absolute instant.
* - UTC ISO string: placed into `value`'s timezone before diffing so the
* calendar anchor matches the value's wall clock.
* - Numeric epoch (ms): same — placed into `value`'s timezone.
* - Omitted: "now" in `value`'s own timezone.
*/
reference?: string | number;
}

zoned/format/formatRelativeZoned.ts