UNPKG

@burglekitt/gmt

Version:

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

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