/** * `` — a date measured from another date. * * The interval is in almost every real record — admitted and discharged, ordered * and shipped, issued and expires, the start and end of a shift — and it could * not be said at all. Two independent date columns put the discharge BEFORE the * admission on a third of the rows, and the workaround people reach for, * non-overlapping windows ("admitted in January, discharged April to June"), * throws away exactly what the interval is for: its length, and how that length * is distributed. "Most stay a week, a few stay months" had no way to be written. * * ── Why it is not a generator ───────────────────────────────────────────────── * * A `Generator` is `(count, prng) => string[]` and sees no other column, by * design — that is what makes a column's values a function of the seed and the * row index alone. This reads a sibling, so it is built here beside `running` * and `stat`, in declaration order, which is also why `of=` must name a column * declared ABOVE it. * * ── What it costs ───────────────────────────────────────────────────────────── * * Unlike `running` and `stat`, row i's answer needs only row i of the source — * nothing accumulates and nothing waits for the last row. It is refused by the * streaming builder today all the same, because the streaming path has no way to * read a sibling column lazily (the same reason a dynamic template defers), and * the router hands the config to the in-memory engine. That is a limit of the * plumbing rather than of the idea, and it is the one worth lifting first if * these configs turn out to be large. */ import type { PlainDateTime } from '../date/index.js'; import type { ColumnOffset, OffsetSpec } from '../date/calendar.js'; import type { Sequence, SequenceSpec } from './types.js'; /** A source column an offset cannot read. */ export declare class DateOffsetError extends Error { readonly name = "DateOffsetError"; } /** The column this date is measured from, or `''` when the generator did not say. */ export declare function offsetOf(spec: SequenceSpec): string; /** True when this `` is an offset rather than a draw. */ export declare function isDateOffset(spec: SequenceSpec): boolean; /** * Publish the offset column. * * One draw per row, and only when the offset is a RANGE: `plus="7d"` is a fixed * distance and consumes no randomness at all, so a config that pins the interval * leaves every other column exactly where it was. * * A row whose source is empty — outside a parent filter, or a source that was * itself filtered — stays empty. There is no date to measure from, and inventing * one would put a value in a cell the config said should have none. */ export declare function registerDateOffset(spec: SequenceSpec, registry: Record, count: number, prng: () => number, locale: string, instantColumns?: ReadonlySet): void; /** * The date row `i` is measured FROM, or `undefined` when the row has none. * * Three readings, in this order: * * 1. **The instant the source column kept.** A `` this engine * built remembers what it generated, so the offset works from the value and * `format=` is free to be anything at all — the cell may read `March 2` or * `02.03.2026` and the arithmetic is the same either way. This is the whole * point of keeping the value beside its rendering. * 2. **No instant on a column that carries them.** `missing="0.1"` blanked * that cell: the source column HAS a date for other rows and none for this * one. The offset has nothing to measure and the cell stays empty — the * same answer a parent filter gets, and the reason this is worth * distinguishing from a text it cannot read. * 3. **The text, read as ISO.** A date that came from a file, a pack, or a * construct that does not carry an instant has only its spelling left. The * ISO form has one reading in every locale, so it is accepted; anything * else is refused rather than guessed at, because `02/03/2026` is the 2nd * of March in one locale and the 3rd of February in another, and picking * one silently would put a wrong date in a column that looks right. */ export declare function startOfRow(column: string, of: string, instantAt: ((row: number) => number | undefined) | undefined, i: number, from: string): PlainDateTime | undefined; /** Row `i`'s instant, when `source` kept them — the first reading `startOfRow` tries. */ export declare function instantReader(source: Sequence): ((row: number) => number | undefined) | undefined; /** * How many steps row `i` moves when `plus=` names a column, or `undefined` when its cell is * empty — `missing=` blanked it, or a parent filter left the row without one — and the date * stays empty with it, as it does when the date it is measured from is missing. * * Only a whole number is a distance. A decimal is refused rather than rounded: `1.5` hours is * ninety minutes, and silently landing on one or two hours would put a wrong time in a column * that looks right. No draw is taken, so adding such a column moves no other value. */ export declare function stepsFromColumn(column: string, offset: ColumnOffset, cell: string | undefined, i: number): number | undefined; /** * How many steps this row moves. * * A fixed offset takes no draw, which is what lets `plus="7d"` be added to a * config without shifting any other column. A range takes exactly one, so the * cost is the same as any other single-value generator. */ export declare function drawSteps(offset: OffsetSpec, prng: () => number): number; //# sourceMappingURL=date-offset.d.ts.map