@flanksource/clicky-ui
Version:
Flanksource Clicky UI — React component library built on shadcn/ui with light/dark and density theming.
46 lines • 1.95 kB
TypeScript
export type TimestampMode = "auto" | "absolute" | "relative" | "time";
export type TimestampFormat = "relative" | "time" | "short" | "iso";
export type TimestampOptions = {
mode?: TimestampMode;
alwaysShowFullOnHover?: boolean;
/**
* When the column is on a DataTable with `autoFilter`, DataTable mounts a
* "Time range" picker (matching the trace UI) and filters rows whose
* timestamp falls outside the selected range. Set `false` to suppress.
*/
autoRangeFilter?: boolean;
/** Override the trace-style preset list ("Last 15 minutes", etc.). */
rangePresets?: Array<{
label: string;
from: string;
to: string;
}>;
/**
* Default range applied on first render. Either side may use date-math
* (`now-24h`, `now`) or any value parseable by `parseTimestamp`.
*/
defaultRange?: {
from?: string;
to?: string;
};
};
export declare function parseTimestamp(value: unknown): Date | null;
/**
* Resolves date-math strings to an absolute Date. Recognised forms:
* - "now"
* - "now-15m", "now-1h", "now+30s", "now-7d", "now-2w" (units: s/m/h/d/w)
* - any value parseable by `parseTimestamp` (ISO, epoch ms/s, Date)
* Returns null for unparseable input.
*/
export declare function resolveDateMath(value: unknown, now?: Date): Date | null;
export declare function chooseTimestampFormat(values: Date[]): TimestampFormat;
export declare function formatTimestamp(date: Date, format: TimestampFormat, now?: Date): string;
export declare function modeToFormat(mode: TimestampMode, dataFormat: TimestampFormat): TimestampFormat;
export type TimestampProps = {
value: unknown;
format: TimestampFormat;
showTitleOnHover?: boolean;
className?: string;
};
export declare function Timestamp({ value, format, showTitleOnHover, className }: TimestampProps): import("react/jsx-runtime").JSX.Element;
//# sourceMappingURL=Timestamp.d.ts.map