@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
15 lines (14 loc) • 604 B
TypeScript
/**
* Sort an array of PlainTime values in ascending or descending order.
*
* - Returns empty array if no valid times.
* - Validation is performed on each item in the array.
*
* @param times Array of ISO PlainTime strings (e.g. "14:30:00")
* @param order "asc" for ascending (earliest first) | "desc" for descending (latest first)
* @returns Sorted array of time strings
*
* @example sortTimes(["14:30:00", "09:00:00", "20:45:00"]) // ["09:00:00", "14:30:00", "20:45:00"]
* @example sortTimes([]) // []
*/
export declare function sortTimes(times: string[], order?: "asc" | "desc"): string[];