@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
14 lines (13 loc) • 589 B
TypeScript
/**
* Return the latest (maximum) of the given PlainDateTime values.
*
* - Returns null if the array is empty or contains 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")
* @returns The latest datetime string, or null on invalid input
*
* @example maxDateTime(["2024-03-10T12:00:00", "2024-03-15T12:00:00", "2024-03-12T12:00:00"]) // "2024-03-15T12:00:00"
* @example maxDateTime([]) // null
*/
export declare function maxDateTime(dateTimes: string[]): string | null;