Skip to content

FormatRelativeKoOptions — @gj-kit/format

A public type from @gj-kit/format. The signature below is taken directly from the 0.1.1 release declaration.

import { FormatRelativeKoOptions } from '@gj-kit/format';
type FormatRelativeKoOptions = {
/** Required explicit clock — this family never reads the system clock itself. */
readonly now: Date;
/** Required: `true` → `'3분 전'`, `false` → `'3분전'`. The apps disagreed. */
readonly suffixSpace: boolean;
/** Required: rendered for null/invalid input. The apps disagreed (`''` vs `'-'`). */
readonly fallback: string;
/**
* Required policy for timestamps after `now`:
* `'empty'` returns `''`; a function renders an absolute form instead.
*/
readonly onFuture: 'empty' | ((date: Date) => string);
/** Label for the <60s bucket. Default `'방금'`. */
readonly justNowLabel?: string | undefined;
/** When set, the 1-day bucket renders this literal (e.g. `'어제'`) instead of `'1일 전'`. */
readonly yesterdayLabel?: string | undefined;
} & ({
readonly maxDays?: undefined;
readonly onOverflow?: undefined;
} | {
/** Elapsed days >= maxDays switch to onOverflow (e.g. 7 → absolute date). */
readonly maxDays: number;
/** Required together with maxDays — there is no built-in absolute rendering. */
readonly onOverflow: (date: Date) => string;
});

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/format
  • Version: 0.1.1
  • Public entry: .
  • Source: GitHub