/** * @fileoverview Fiscal year and accounting period utilities * Supports configurable fiscal year start months for business calculations */ /** * Fiscal year configuration */ export interface FiscalConfig { /** Month when fiscal year starts (1-12, default: 1 for January) */ startMonth: number; } /** * Get the fiscal year for a given date * @param date - The date to check * @param config - Fiscal year configuration * @returns The fiscal year number * @example * // Calendar year (Jan start) * getFiscalYear(new Date('2024-03-15')) // 2024 * * // April fiscal year (UK/India style) * getFiscalYear(new Date('2024-03-15'), { startMonth: 4 }) // 2023 * getFiscalYear(new Date('2024-04-15'), { startMonth: 4 }) // 2024 * * // July fiscal year (Australia style) * getFiscalYear(new Date('2024-06-15'), { startMonth: 7 }) // 2023 * getFiscalYear(new Date('2024-07-15'), { startMonth: 7 }) // 2024 */ export declare function getFiscalYear(date: Date, config?: Partial): number; /** * Get the fiscal quarter for a given date (1-4) * @param date - The date to check * @param config - Fiscal year configuration * @returns The fiscal quarter (1-4) * @example * // Calendar year quarters * getFiscalQuarter(new Date('2024-01-15')) // 1 * getFiscalQuarter(new Date('2024-04-15')) // 2 * * // April fiscal year * getFiscalQuarter(new Date('2024-04-15'), { startMonth: 4 }) // 1 * getFiscalQuarter(new Date('2024-07-15'), { startMonth: 4 }) // 2 */ export declare function getFiscalQuarter(date: Date, config?: Partial): number; /** * Get the start date of a fiscal year * @param fiscalYear - The fiscal year * @param config - Fiscal year configuration * @returns Start date of the fiscal year * @example * getFiscalYearStart(2024) // 2024-01-01 * getFiscalYearStart(2024, { startMonth: 4 }) // 2024-04-01 (FY2024 starts Apr 2024) * getFiscalYearStart(2024, { startMonth: 7 }) // 2024-07-01 (FY2024 starts Jul 2024) */ export declare function getFiscalYearStart(fiscalYear: number, config?: Partial): Date; /** * Get the end date of a fiscal year * @param fiscalYear - The fiscal year * @param config - Fiscal year configuration * @returns End date of the fiscal year (last day, 23:59:59.999) * @example * getFiscalYearEnd(2024) // 2024-12-31 * getFiscalYearEnd(2024, { startMonth: 4 }) // 2025-03-31 (FY2024 ends Mar 2025) * getFiscalYearEnd(2024, { startMonth: 7 }) // 2025-06-30 (FY2024 ends Jun 2025) */ export declare function getFiscalYearEnd(fiscalYear: number, config?: Partial): Date; /** * Get the start date of a fiscal quarter * @param fiscalYear - The fiscal year * @param quarter - The quarter (1-4) * @param config - Fiscal year configuration * @returns Start date of the fiscal quarter * @example * getFiscalQuarterStart(2024, 1) // 2024-01-01 * getFiscalQuarterStart(2024, 2) // 2024-04-01 * getFiscalQuarterStart(2024, 1, { startMonth: 4 }) // 2023-04-01 * getFiscalQuarterStart(2024, 2, { startMonth: 4 }) // 2023-07-01 */ export declare function getFiscalQuarterStart(fiscalYear: number, quarter: number, config?: Partial): Date; /** * Get the end date of a fiscal quarter * @param fiscalYear - The fiscal year * @param quarter - The quarter (1-4) * @param config - Fiscal year configuration * @returns End date of the fiscal quarter (last day, 23:59:59.999) * @example * getFiscalQuarterEnd(2024, 1) // 2024-03-31 * getFiscalQuarterEnd(2024, 2) // 2024-06-30 * getFiscalQuarterEnd(2024, 1, { startMonth: 4 }) // 2023-06-30 */ export declare function getFiscalQuarterEnd(fiscalYear: number, quarter: number, config?: Partial): Date; /** * Check if two dates are in the same fiscal year * @param date1 - First date * @param date2 - Second date * @param config - Fiscal year configuration * @returns True if both dates are in the same fiscal year */ export declare function isSameFiscalYear(date1: Date, date2: Date, config?: Partial): boolean; /** * Check if two dates are in the same fiscal quarter * @param date1 - First date * @param date2 - Second date * @param config - Fiscal year configuration * @returns True if both dates are in the same fiscal year and quarter */ export declare function isSameFiscalQuarter(date1: Date, date2: Date, config?: Partial): boolean; /** * Get the fiscal month (1-12) within the fiscal year * @param date - The date to check * @param config - Fiscal year configuration * @returns The fiscal month (1-12, where 1 is the first month of fiscal year) * @example * getFiscalMonth(new Date('2024-01-15')) // 1 * getFiscalMonth(new Date('2024-04-15'), { startMonth: 4 }) // 1 * getFiscalMonth(new Date('2024-03-15'), { startMonth: 4 }) // 12 */ export declare function getFiscalMonth(date: Date, config?: Partial): number; /** * Get the number of days remaining in the fiscal year * @param date - The date to check * @param config - Fiscal year configuration * @returns Number of days remaining in the fiscal year */ export declare function getDaysRemainingInFiscalYear(date: Date, config?: Partial): number; /** * Get the number of days elapsed in the fiscal year * @param date - The date to check * @param config - Fiscal year configuration * @returns Number of days elapsed in the fiscal year (including the given date) */ export declare function getDaysElapsedInFiscalYear(date: Date, config?: Partial): number; /** * Get fiscal year progress as a percentage * @param date - The date to check * @param config - Fiscal year configuration * @returns Percentage of fiscal year completed (0-100) */ export declare function getFiscalYearProgress(date: Date, config?: Partial): number; /** * Get the fiscal week number (1-53) within the fiscal year * @param date - The date to check * @param config - Fiscal year configuration * @returns The fiscal week number */ export declare function getFiscalWeek(date: Date, config?: Partial): number; /** * Common fiscal year configurations */ export declare const FISCAL_PRESETS: { /** Calendar year (January start) - Default */ readonly CALENDAR: FiscalConfig; /** UK/India government fiscal year (April start) */ readonly UK_INDIA: FiscalConfig; /** Australian fiscal year (July start) */ readonly AUSTRALIA: FiscalConfig; /** US federal government fiscal year (October start) */ readonly US_FEDERAL: FiscalConfig; }; /** * Format fiscal year as string (e.g., "FY2024" or "FY2023/24") * @param fiscalYear - The fiscal year * @param config - Fiscal year configuration * @param format - Format style: 'short' (FY2024) or 'long' (FY2023/24) * @returns Formatted fiscal year string */ export declare function formatFiscalYear(fiscalYear: number, config?: Partial, format?: 'short' | 'long'): string; /** * Format fiscal quarter as string (e.g., "Q1 FY2024") * @param fiscalYear - The fiscal year * @param quarter - The quarter (1-4) * @param config - Fiscal year configuration * @returns Formatted fiscal quarter string */ export declare function formatFiscalQuarter(fiscalYear: number, quarter: number, config?: Partial): string; /** * Get fiscal period info for a date * @param date - The date to analyze * @param config - Fiscal year configuration * @returns Object with fiscal period information */ export declare function getFiscalPeriodInfo(date: Date, config?: Partial): { fiscalYear: number; fiscalQuarter: number; fiscalMonth: number; fiscalWeek: number; daysElapsed: number; daysRemaining: number; progress: number; quarterStart: Date; quarterEnd: Date; yearStart: Date; yearEnd: Date; }; //# sourceMappingURL=fiscal.d.ts.map