@northguild/gmt
Version:
Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.
13 lines • 588 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;