import { TimeUnit } from './constants.js'; /** * Calculate difference between two dates in specified unit * @param date1 - first date * @param date2 - second date * @param unit - unit to return the difference in * @param precise - if true, returns decimal values; if false, returns integers */ export declare function differenceInUnits(date1: Date, date2: Date, unit?: TimeUnit, precise?: boolean): number; /** * Calculate the difference in local calendar days between two dates. * * Unlike differenceInUnits(date1, date2, 'days'), this ignores the time of day * and counts date boundaries, so late today to midnight two dates from now is 2. */ export declare function differenceInCalendarDays(date1: Date, date2: Date): number; /** * Add time to a date * @param date - base date * @param amount - amount to add * @param unit - unit of the amount */ export declare function addTime(date: Date, amount: number, unit: TimeUnit): Date; /** * Subtract time from a date * @param date - base date * @param amount - amount to subtract * @param unit - unit of the amount */ export declare function subtractTime(date: Date, amount: number, unit: TimeUnit): Date; /** * Get the start of a time period for a given date * @param date - input date * @param unit - time unit to get the start of */ export declare function startOf(date: Date, unit: 'day' | 'week' | 'month' | 'year' | 'hour' | 'minute'): Date; /** * Get the end of a time period for a given date * @param date - input date * @param unit - time unit to get the end of */ export declare function endOf(date: Date, unit: 'day' | 'week' | 'month' | 'year' | 'hour' | 'minute'): Date; /** * Check if a date is between two other dates * @param date - date to check * @param start - start date (inclusive) /** * Check if a date falls between two dates * @param date - date to check * @param start - start date * @param end - end date * @param inclusive - whether boundaries are inclusive (default: true) */ export declare function isBetween(date: Date, start: Date, end: Date, inclusive?: boolean): boolean; /** * Get the number of business days between two dates (excludes weekends) * @param startDate - start date * @param endDate - end date */ export declare function businessDaysBetween(startDate: Date, endDate: Date): number; /** * Round a date to the nearest unit (rounds to closest) * @param date - date to round * @param unit - unit to round to * @example * roundToNearestUnit(new Date('2024-03-15T14:37:00'), 'hour') // 15:00 * roundToNearestUnit(new Date('2024-03-15T14:22:00'), 'hour') // 14:00 */ export declare function roundToNearestUnit(date: Date, unit: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month'): Date; /** * Round a date up (ceiling) to the specified unit * @param date - date to round * @param unit - unit to round to * @example * ceilDate(new Date('2024-03-15T14:01:00'), 'hour') // 15:00 */ export declare function ceilDate(date: Date, unit: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month'): Date; /** * Round a date down (floor) to the specified unit * @param date - date to round * @param unit - unit to round to * @example * floorDate(new Date('2024-03-15T14:59:00'), 'hour') // 14:00 */ export declare function floorDate(date: Date, unit: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month'): Date; //# sourceMappingURL=calculate.d.ts.map