import { DateRangeValue } from './types/date.types'; /** * Time unit types for date range calculations */ export type TimeUnit = 'day' | 'month' | 'quarter' | 'week' | 'year'; /** * Week type for start of week calculations */ export type WeekStartDay = 'monday' | 'sunday'; /** * Configuration options for date range presets */ export interface DateRangeConfig { /** * First month of fiscal year (0-11, default: 0 for January) */ fiscalYearStartMonth?: number; /** * First day of the week (default: 'sunday') */ weekStartsOn?: WeekStartDay; } /** * Configure date range preset behavior */ export declare function configureDateRangePresets(options: DateRangeConfig): void; /** * Creates a date range for a relative period (e.g., "this month", "last week", "next year") * * @param unit - The time unit (day, week, month, quarter, year) * @param offset - Offset from current period (0 = this, -1 = last, 1 = next) * @returns A function that returns the date range * * @example * createRelativePeriod('month', 0) // This month * createRelativePeriod('week', -1) // Last week * createRelativePeriod('year', 1) // Next year */ export declare function createRelativePeriod(unit: TimeUnit, offset?: number): () => DateRangeValue; /** * Creates a rolling date range (e.g., "last 7 days", "next 30 days") * * @param count - Number of units * @param unit - The time unit (day, week, month, year) * @param direction - 'past' for last N units, 'future' for next N units * @returns A function that returns the date range * * @example * createRollingPeriod(7, 'day', 'past') // Last 7 days * createRollingPeriod(3, 'month', 'past') // Last 3 months * createRollingPeriod(30, 'day', 'future') // Next 30 days */ export declare function createRollingPeriod(count: number, unit: TimeUnit, direction?: 'future' | 'past'): () => DateRangeValue; /** * Creates a "period to date" range (e.g., "month to date", "year to date") * * @param unit - The time unit (week, month, quarter, year) * @returns A function that returns the date range from start of period to now * * @example * createPeriodToDate('month') // Month to date * createPeriodToDate('year') // Year to date * createPeriodToDate('quarter') // Quarter to date */ export declare function createPeriodToDate(unit: Exclude): () => DateRangeValue; /** * Creates a date range for a specific absolute period * * @param year - The year * @param unit - The time unit * @param period - The period number (month: 0-11, quarter: 1-4, week: 1-53) * @returns A function that returns the date range * * @example * createSpecificPeriod(2024, 'year') // Entire year 2024 * createSpecificPeriod(2024, 'quarter', 2) // Q2 2024 * createSpecificPeriod(2024, 'month', 5) // June 2024 (month 5) */ export declare function createSpecificPeriod(year: number, unit: TimeUnit, period?: number): () => DateRangeValue; /** * Creates a custom date range between two specific dates * * @param startDate - Start date * @param endDate - End date * @returns A function that returns the date range * * @example * createCustomRange(new Date('2024-01-01'), new Date('2024-12-31')) */ export declare function createCustomRange(startDate: Date, endDate: Date): () => DateRangeValue; /** * Creates a fiscal year date range * * @param year - The fiscal year * @param startMonth - Starting month of fiscal year (0-11, defaults to configured value) * @returns A function that returns the date range * * @example * createFiscalYear(2024) // Uses configured fiscal year start * createFiscalYear(2024, 3) // Fiscal year starting in April */ export declare function createFiscalYear(year: number, startMonth?: number): () => DateRangeValue; /** * Common date range preset functions using the builder API */ export declare const dateRangePresets: { allTime: () => DateRangeValue; last2Weeks: () => DateRangeValue; last2Years: () => DateRangeValue; last3Months: () => DateRangeValue; last6Months: () => DateRangeValue; last7Days: () => DateRangeValue; last12Months: () => DateRangeValue; last14Days: () => DateRangeValue; last30Days: () => DateRangeValue; last60Days: () => DateRangeValue; last90Days: () => DateRangeValue; last180Days: () => DateRangeValue; last365Days: () => DateRangeValue; lastMonth: () => DateRangeValue; lastQuarter: () => DateRangeValue; lastWeek: () => DateRangeValue; lastYear: () => DateRangeValue; lifetime: () => DateRangeValue; monthToDate: () => DateRangeValue; next7Days: () => DateRangeValue; next14Days: () => DateRangeValue; next30Days: () => DateRangeValue; next90Days: () => DateRangeValue; nextMonth: () => DateRangeValue; nextQuarter: () => DateRangeValue; nextWeek: () => DateRangeValue; nextYear: () => DateRangeValue; quarterToDate: () => DateRangeValue; thisMonth: () => DateRangeValue; thisQuarter: () => DateRangeValue; thisWeek: () => DateRangeValue; thisYear: () => DateRangeValue; today: () => DateRangeValue; tomorrow: () => DateRangeValue; weekToDate: () => DateRangeValue; yesterday: () => DateRangeValue; yearToDate: () => DateRangeValue; };