# isValidCalendarZonedDateTime

Industry: Core

## Signature

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

Return true if `value` is a valid GMT ZonedDateTime string: a bare ISO zoned datetime ("2024-10-03T14:30:45+02:00[Africa/Johannesburg]") or an RFC 9557 calendar-annotated one ("2024-10-03T14:30:45+02:00[Africa/Johannesburg][u-ca=hebrew]"), as `Temporal.ZonedDateTime#toString()` and `convertZonedToCalendar` write it.

- Parallel to `isValidZonedDateTime`, which accepts no calendar annotation. Only the calendar-aware `zoned/` functions gate on this validator, so a string is never certified by a validator whose own namespace refuses it.
- The calendar annotation follows the time zone annotation (RFC 9557 §4.1); a calendar before the zone, which Temporal also rejects, returns false.
- A `[u-ca=<id>]` annotation, optionally critical. Temporal's `CanonicalizeCalendar` validates the id (folding case and aliases), and the calendar must be one GMT supports (`CalendarSystem`).
- At most one annotation beyond the zone, the `u-ca` one, after the zone. An elective or unknown critical annotation (`[foo=bar]`, `[!foo=bar]`) and a second `u-ca` annotation return false.
- The part before the zone must be ISO 8601 extended format, as `isValidZonedDateTime` requires: basic format, a space or lower-case `t` separator, a lower-case `z`, an hour-only time or offset and a date without a time return false.
- Rejects leap seconds, which `Temporal.ZonedDateTime.from` otherwise clamps to `:59`.
- Delegates the date, time, offset, zone and annotation checks to `Temporal.ZonedDateTime.from` (via `parseCalendarZonedValue`).
- Returns false for an empty string.
- A value that is not a string, a `String` object included, returns `false`. A `true` result narrows an `unknown` value to `string`. Compatibility: since 1.16.0 the string is RFC 9557. Earlier releases accepted calendar-native digits, `;era=`, the calendar annotation before the zone, and the ids `gregorian`, `taiwan`, `islamic-tabular` and `ethiopic-amete-alem`.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | any value; a string is checked as a zoned datetime, optionally calendar-annotated |

## Returns

boolean indicating validity

## Examples

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

isValidCalendarZonedDateTime("2024-10-03T14:30:45+02:00[Africa/Johannesburg]") // true
```

## Source

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