UNPKG

@burglekitt/gmt

Version:

Temporal-based date and time utilities with timezone support and polyfill integration

17 lines (16 loc) 1.03 kB
/** * Return an array of plain ISO date strings covering the inclusive date range between two zoned datetimes. * * - Both datetimes must have the same timezone. * - Returns [] for invalid inputs, mismatched timezones, start > end, or invalid step. * * @param startZonedDateTime start zoned ISO 8601 datetime string * @param endZonedDateTime end zoned ISO 8601 datetime string * @param stepDays optional positive integer step in days * @returns array of ISO date strings or [] when invalid * * @example mapZonedDatesInRange("2024-02-28T12:00:00+00:00[UTC]", "2024-03-02T12:00:00+00:00[UTC]") // ["2024-02-28", "2024-02-29", "2024-03-01", "2024-03-02"] * @example mapZonedDatesInRange("2024-02-28T12:00:00+00:00[UTC]", "2024-03-02T12:00:00+00:00[UTC]", 2) // ["2024-02-28", "2024-03-01"] * @example mapZonedDatesInRange("invalid", "2024-03-02T12:00:00+00:00[UTC]") // [] */ export declare function mapZonedDatesInRange(startZonedDateTime: string, endZonedDateTime: string, ...stepDaysInput: [stepDays?: number]): string[];