# maxDateTime

Industry: Core

## Signature

```ts
maxDateTime(dateTimes: string[]): string | null
```

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.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `dateTimes` | `string[]` | Array of ISO PlainDateTime strings (e.g. "2024-03-10T12:00:00") |

## Returns

The latest datetime string, or null on invalid input

## Examples

```ts
import { maxDateTime } from "@northguild/gmt/plain/calculate";

maxDateTime(["2024-03-10T12:00:00", "2024-03-15T12:00:00", "2024-03-12T12:00:00"]) // "2024-03-15T12:00:00"
```

## Source

[plain/calculate/maxDateTime.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/plain/calculate/maxDateTime.ts)
