@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.
15 lines • 790 B
TypeScript
/**
* Return the earliest (minimum) 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 earliest zoned datetime string, or null on invalid input
*
* @example minZoned(["2024-03-10T12:00:00[America/Sao_Paulo]", "2024-03-15T12:00:00[America/Sao_Paulo]"]) // "2024-03-10T12:00:00-03:00[America/Sao_Paulo]"
* @example minZoned(["invalid", "2024-03-15T12:00:00[America/Sao_Paulo]"]) // "2024-03-15T12:00:00-03:00[America/Sao_Paulo]"
* @example minZoned(["invalid", "also invalid"]) // null
* @example minZoned([]) // null
*/
export declare function minZoned(zonedDateTimes: string[]): string | null;