# isValidRfc3339DateTime

Industry: Core

## Signature

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

Return true when `value` is a real RFC 3339 date-time: an ISO 8601 date and time that always states its UTC offset, as `Z` or `±HH:MM` (RFC 3339 §5.6).

- True exactly when `parseRfc3339` returns a zoned string for the same value: the validator calls the parser, so the two cannot disagree.
- Checks the calendar as well as the shape. The `rfc3339DateTime` pattern proves the shape alone, so it matches a day that does not exist: 29 February in a common year and 31 June are false here.
- Accepts `T`, `t` or a single space between the date and the time, `Z` or `z`, a numeric offset from `-23:59` to `+23:59`, and up to nine fraction digits.
- False for a leap second (`:60`), although §5.6 `time-second` admits it: GMT rejects leap seconds because Temporal would read one as `:59`.
- False for GMT's own zoned strings, which carry a bracketed zone (`...+00:00[UTC]`): that annotation is not RFC 3339. Check those with `isValidZonedDateTime`.
- A value that is not a string, a `String` object included, returns `false`. A `true` result narrows an `unknown` value to `string`.
- Read the value with `parseRfc3339`; write one with `formatRfc3339`.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | any value; a string is checked as an RFC 3339 date-time |

## Returns

boolean indicating validity

## Examples

```ts
import { isValidRfc3339DateTime } from "@northguild/gmt/zoned/validate";

isValidRfc3339DateTime("2024-03-15T14:30:00-04:00") // true
```

## Source

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