datemapper
Version:
A lightweight date utility for format conversion, validation, and date manipulation.
15 lines (14 loc) • 904 B
TypeScript
import { TIncrementType } from "./types";
/**
* Generates an array of dates between two specified dates, incremented by a given type and formatted.
* Ensures all dates are correctly adjusted for the specified timezone.
*
* @param from - The start date in string format (YYYY-MM-DD).
* @param to - The end date in string format (YYYY-MM-DD).
* @param ic - The type of increment to apply between the start and end dates.
* @param timezone - The timezone in which the dates should be interpreted (default: "UTC").
* @param out - The moment.js format string to be applied to each date in the output array. Defaults to 'YYYY-MM-DD'.
* @returns An array of strings representing dates between the start and end dates, formatted according to `out`.
*/
declare const datesBetween: (from: string, to: string, ic: TIncrementType, out?: string, timezone?: string) => string[];
export default datesBetween;