@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
16 lines (15 loc) • 782 B
TypeScript
/**
* Return the latest (maximum) of the given ZonedDateTime values.
*
* - Returns null if the array is empty or contains no valid dates.
* - Validation is performed on each item in the array.
*
* @param zonedDateTimes Array of ISO ZonedDateTime strings
* @returns The latest zoned datetime string, or null on invalid input
*
* @example maxZoned(["2024-03-10T12:00:00[America/New_York]", "2024-03-15T12:00:00[America/New_York]"]) // "2024-03-15T12:00:00-04:00[America/New_York]"
* @example maxZoned(["invalid", "2024-03-15T12:00:00[America/New_York]"]) // "2024-03-15T12:00:00-04:00[America/New_York]"
* @example maxZoned(["invalid", "also invalid"]) // null
* @example maxZoned([]) // null
*/
export declare function maxZoned(zonedDateTimes: string[]): string | null;