# isValidDateTime

Industry: Core

## Signature

```ts
isValidDateTime(value: string): boolean
isValidDateTime(value: void | {} | null | undefined): boolean
isValidDateTime(value: unknown): value is string
```

Return true when `value` is a valid PlainDateTime string.

- The whole string must match `plainDateTime`.
- Accepts no annotation of any kind: a time zone, a calendar (`[u-ca=iso8601]`) or an elective one (`[foo=bar]`) returns `false`.
- Rejects leap seconds (e.g., "2024-02-29T23:59:60").
- Rejects invalid dates (e.g., "2024-02-30") and invalid times (e.g., "2024-02-29T24:00:00").
- A value that is not a string, a `String` object included, returns `false`. A `true` result narrows an `unknown` value to `string`.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | any value; a string is checked as an ISO PlainDateTime |

## Returns

boolean indicating whether the value is a valid PlainDateTime string

## Examples

```ts
import { isValidDateTime } from "@northguild/gmt/plain/validate";

isValidDateTime("2024-02-29T12:34:56") // true
```

## Source

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