/** * Tolerant date parsing and calendar-delta helpers for the date detector. * * The detector needs to (a) recognize whether source values are dates, (b) keep * the *input shape* so output matches (a `Date` column emits `Date`s, an * ISO-string column emits ISO strings), and (c) classify the step between * consecutive dates as a whole number of days, months or years. * * @packageDocumentation */ /** Milliseconds in one calendar day. */ export declare const DAY_MS = 86400000; /** How a parsed date was represented in the source, so output can match it. */ export declare enum DateShape { /** A native `Date` object. */ DateObject = "date", /** An ISO `YYYY-MM-DD` string. */ IsoDate = "iso-date" } /** A source value parsed into a date plus the shape it arrived in. */ export interface ParsedDate { /** Local-time date (time component zeroed for date-only shapes). */ readonly date: Date; /** The representation to emit back. */ readonly shape: DateShape; } /** * Parses a source value into a {@link ParsedDate}, or `null` when it is not a * date this detector handles (native `Date` or ISO `YYYY-MM-DD` string). * * @param value - The source value. * @returns The parsed date + shape, or `null`. */ export declare function parseDate(value: unknown): ParsedDate | null; /** * Formats a `Date` back into the requested shape. * * @param date - The date to emit. * @param shape - The representation to produce. * @returns A `Date` or an ISO `YYYY-MM-DD` string. */ export declare function formatDate(date: Date, shape: DateShape): Date | string; /** Whole-calendar-months between two dates when day-of-month is preserved, else `null`. */ export declare function wholeMonthsBetween(a: Date, b: Date): number | null; /** Whole-calendar-years between two dates when month/day are preserved, else `null`. */ export declare function wholeYearsBetween(a: Date, b: Date): number | null; /** Whole days between two local dates when the gap is an exact day multiple, else `null`. */ export declare function wholeDaysBetween(a: Date, b: Date): number | null; /** * Adds `n` calendar months to a date, clamping the day to the target month's * length (Jan 31 + 1mo → Feb 28/29), matching spreadsheet behavior. */ export declare function addMonths(date: Date, n: number): Date; /** Adds `n` calendar years, clamping Feb 29 to Feb 28 on non-leap targets. */ export declare function addYears(date: Date, n: number): Date; /** Adds `n` days (may be negative) to a date. */ export declare function addDays(date: Date, n: number): Date; //# sourceMappingURL=date-parse.d.ts.map