import { type DateTimezoneUtcNormalFunctionInput, type DateTimezoneUtcNormalInstance } from './date.timezone'; import { type DateRange } from './date.range'; /** * Modifies the input DateRange to fit within a 24 hour period. * * I.E. 12:00AM 1/1/2020 to 12:00PM 1/4/2020 becomes 12:00AM 1/1/2020 to 12:00PM 1/1/2020 */ export type FitDateRangeToDayPeriodFunction = ((dateRange: T) => T) & { readonly _timezoneInstance: DateTimezoneUtcNormalInstance; }; /** * Creates a {@link FitDateRangeToDayPeriodFunction} that collapses a multi-day date range into a single-day period within the given timezone. * * The function first normalizes the range into the target timezone, fits it to a 24-hour period, then converts back. * * @param timezone - Timezone applied when collapsing the range to a single day. * @returns Fitter that snaps any range to a single-day window in the bound timezone. * * @example * ```ts * const fit = fitDateRangeToDayPeriodFunction('America/Chicago'); * const range = { start: new Date('2024-01-01T10:00:00Z'), end: new Date('2024-01-03T14:00:00Z') }; * const fitted = fit(range); * // fitted spans from 10:00 to 14:00 on the same day (4 hours) * ``` * * @__NO_SIDE_EFFECTS__ */ export declare function fitDateRangeToDayPeriodFunction(timezone: DateTimezoneUtcNormalFunctionInput): FitDateRangeToDayPeriodFunction; /** * Fits the DateRange to a single "day" period from the start time within the given timezone. * * Convenience wrapper around {@link fitDateRangeToDayPeriodFunction}. * * @param dateRange - Range to collapse onto a single calendar day. * @param timezone - Timezone governing the day boundary calculation. * @returns Range snapped to a single-day window in the target timezone. */ export declare function fitDateRangeToDayPeriod(dateRange: T, timezone: DateTimezoneUtcNormalFunctionInput): T;