maxUtc
Signature
Section titled “Signature”maxUtc(utcDateTimes: string[]): stringimport { maxUtc } from "@northguild/gmt/utc/calculate";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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
utcDateTimes |
string[] |
Array of ISO datetime strings (e.g. “2024-03-10T12:00:00Z”) |
Returns
Section titled “Returns”The latest UTC datetime string, or null on invalid input
Examples
Section titled “Examples”maxUtc(["2024-03-10T12:00:00Z", "2024-03-15T12:00:00Z", "2024-03-12T12:00:00Z"]) // "2024-03-15T12:00:00Z"maxUtc(["invalid", "2024-03-15T12:00:00Z"]) // "2024-03-15T12:00:00Z"maxUtc(["invalid", "also invalid"]) // nullmaxUtc([]) // null