/** * Pure date helpers for . * * Everything works in LOCAL time and on whole days. No dependency (no * date-fns / moment), and no function mutates the Date it receives. */ export type VerbenDateFormat = 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'YYYY-MM-DD'; /** [start, end] of a period. start is 00:00:00.000, end is 23:59:59.999 */ export type DateSpan = [Date, Date]; export declare const startOfDay: (d: Date) => Date; export declare const endOfDay: (d: Date) => Date; export declare const addDays: (d: Date, days: number) => Date; /** Adds months, keeping the day but clamping it (Jan 31 + 1 month = Feb 28/29) */ export declare function addMonths(d: Date, months: number): Date; export declare const daysInMonth: (d: Date) => number; export declare const startOfMonth: (d: Date) => Date; export declare const endOfMonth: (d: Date) => Date; /** First day of the week containing d (weekStartsOn: 0 = Sunday, 1 = Monday) */ export declare function startOfWeek(d: Date, weekStartsOn: 0 | 1): Date; export declare const endOfWeek: (d: Date, weekStartsOn: 0 | 1) => Date; /** ISO 8601 week number (weeks start on Monday, week 1 contains 4 January) */ export declare function isoWeek(d: Date): number; /** Quarter number 1-4 */ export declare const quarterOf: (d: Date) => number; export declare const startOfQuarter: (d: Date) => Date; export declare const endOfQuarter: (d: Date) => Date; export declare const startOfYear: (d: Date) => Date; export declare const endOfYear: (d: Date) => Date; export declare const isSameDay: (a: Date, b: Date) => boolean; /** Negative if a is an earlier day than b, 0 if same day, positive if later */ export declare const compareDays: (a: Date, b: Date) => number; /** Number of days in a span, counting both ends (Oct 1 - Oct 7 = 7) */ export declare const dayCount: (start: Date, end: Date) => number; /** * Accepts a Date or a date string and returns a Date in LOCAL time. * "2026-10-07" and "2026-10-07T09:30:00" are read as local time on purpose: * `new Date("2026-10-07")` would be UTC midnight, i.e. the previous day in * time zones west of UTC. A trailing "Z" is ignored, like the old date picker. */ export declare function parseDate(value: unknown): Date | null; /** "2026-10-07T00:00:00": local time, no time zone (same as the old picker) */ export declare function toLocalIso(d: Date): string; export declare function formatDate(d: Date, format: VerbenDateFormat): string; /** * Trims a span to [min, max]. Returns null when nothing is left, so callers * can disable a preset that falls completely outside the allowed dates. */ export declare function clampSpan(span: DateSpan, min?: Date | null, max?: Date | null): DateSpan | null; /** "Sep 1 – Sep 30", with the year only when it isn't today's year */ export declare function formatShortSpan([start, end]: DateSpan, today: Date): string; export declare const isOutside: (d: Date, min?: Date | null, max?: Date | null) => boolean;