UNPKG

@burglekitt/gmt

Version:

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

15 lines (14 loc) 618 B
/** * Sort an array of PlainDate values in ascending or descending order. * * - Returns empty array if no valid dates. * - Validation is performed on each item in the array. * * @param dates Array of ISO PlainDate strings (e.g. "2024-03-10") * @param order "asc" for ascending (earliest first) | "desc" for descending (latest first) * @returns Sorted array of date strings * * @example sortDates(["2024-03-10", "2024-01-01", "2024-02-15"]) // ["2024-01-01", "2024-02-15", "2024-03-10"] * @example sortDates([]) // [] */ export declare function sortDates(dates: string[], order?: "asc" | "desc"): string[];