@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
16 lines (15 loc) • 705 B
TypeScript
/**
* Return the latest (maximum) of the given UTC datetime values.
*
* - Filters invalid values before finding maximum.
* - Returns null if array is empty or has no valid values.
*
* @param utcDateTimes Array of ISO datetime strings (e.g. "2024-03-10T12:00:00Z")
* @returns The latest UTC datetime string, or null on invalid input
*
* @example maxUtc(["2024-03-10T12:00:00Z", "2024-03-15T12:00:00Z", "2024-03-12T12:00:00Z"]) // "2024-03-15T12:00:00Z"
* @example maxUtc(["invalid", "2024-03-15T12:00:00Z"]) // "2024-03-15T12:00:00Z"
* @example maxUtc(["invalid", "also invalid"]) // null
* @example maxUtc([]) // null
*/
export declare function maxUtc(utcDateTimes: string[]): string | null;