export type TimeRangeMode = "relative" | "absolute"; export type TimeRange = { mode: TimeRangeMode; /** Present ONLY for relative ranges — the resolved preset token (e.g. "30m"). */ relative?: string; /** Epoch ms, inclusive lower bound. Always <= `to`. */ from: number; /** Epoch ms, inclusive upper bound. */ to: number; }; export type TimeRangePreset = string | { token: string; label?: string; durationMs?: number; }; export declare const DEFAULT_TIME_RANGE_PRESETS: string[]; /** * Parses a preset token ("30m", "1h", "7d", "2w", ...) into a duration in ms. * Returns null when the token doesn't match the locked grammar * `^(\d+)(m|h|d|w)$`. */ export declare function parsePresetMs(token: string): number | null; /** * Resolves a relative preset token to a concrete {@link TimeRange} anchored at * `now`. `to` is clamped to `max` (if given) and `from` is clamped to `min` * (if given). Returns null when the token doesn't parse OR when, after * clamping, the window collapses (`from > to`) — the caller (the component) * treats a null resolution as "disable this preset". */ export declare function resolveRelative(token: string, now: number, opts?: { min?: number; max?: number; }): TimeRange | null; export type AbsoluteSplit = { fromDate: string; fromTime: string; toDate: string; toTime: string; }; /** * Splits an epoch-ms `from`/`to` pair into local-timezone date/time parts, one * pair per bound. Used to seed the Custom tab's calendar + time pickers + * typed inputs from a concrete range (relative or absolute). */ export declare function splitAbsolute(from: number, to: number): AbsoluteSplit; export type AbsoluteDraft = { fromDate?: string; fromTime?: string; toDate?: string; toTime?: string; }; /** * Composes a staged Custom-tab draft into a concrete {from,to} epoch-ms pair. * Returns null when the draft is incomplete, any part fails to parse, or the * composed `from` is after `to` — the caller uses null to disable Apply and * show an inline error. */ export declare function composeAbsolute(draft: AbsoluteDraft): { from: number; to: number; } | null; /** * Human label for a preset token ("30m" -> "30 dernières minutes" / "Last 30 * minutes"). Falls back to the raw token when it doesn't match the grammar * (e.g. a caller-provided custom token) so the UI never renders empty text. */ export declare function formatPresetLabel(token: string, locale?: string): string; /** * Human label for the picker's trigger button: the preset label for a * relative value, or a formatted date range for an absolute one — collapsing * to a single date + "HH:mm–HH:mm" when both bounds fall on the same local * calendar day. */ export declare function formatTriggerLabel(value: TimeRange, locale?: string): string; //# sourceMappingURL=timeRange.d.ts.map