export interface PeriodInput { /** Last N days, counted from local midnight N-1 days ago through now. */ days?: number; /** Just today, in local time. */ today?: boolean; /** Explicit ISO 8601 bounds; override `days`/`today`. */ since?: string; until?: string; } export interface Period { since?: string; until?: string; /** Human-readable description, e.g. "last 7 days (local time)". */ label: string; /** * The comparable window immediately before this one, when one exists. * * Resolved HERE rather than derived later from `since`/`until`, for two * reasons. It is aligned to the same local midnights the period itself uses, * so `--days 7` compares against the seven whole days before -- not against * "the 156 hours before", which is what subtracting an open window's elapsed * length gives. And it is a pure function of the request, so two processes * answering the same question describe the same window rather than differing * by however many milliseconds apart they read the clock. * * Absent for "all time", which has no window before it. */ previous?: { since: string; until: string; label: string; }; } /** * Asked to compare against a window that does not exist. * * Its own class so the CLI can report it as the usage error it is -- one line * and exit 2, like any other bad flag combination -- rather than as an * unexpected failure with a stack trace. */ export declare class ComparePeriodError extends RangeError { } /** * Resolves a period. Day boundaries are LOCAL, because "today" means the user's * today; the stored timestamps are UTC and converted here rather than at query time. */ export declare function resolvePeriod(input?: PeriodInput): Period;