# intervalContainsZoned

Industry: Core

## Signature

```ts
intervalContainsZoned(intervalStart: string, intervalEnd: string, pointOrStart: string, pointEnd?: string): boolean
```

Return true when `pointOrStart` falls within the half-open interval `[intervalStart, intervalEnd)` (3-arg), or when the inner interval `[innerStart, innerEnd)` lies within the outer interval `[intervalStart, intervalEnd)` (4-arg).

- Uses `Temporal.Instant.compare` for comparison (same instant semantics).
- Point mode: `start <= point < end`, the same rule as `intervalContains`. The `end` is excluded, so a point at `end`'s instant returns `false`, and an empty interval (`start` and `end` the same instant) contains no point.
- Interval mode: the intervals overlap and `start <= innerStart` and `innerEnd <= end`. An inner interval may share the outer `end`. An empty inner interval counts only strictly inside the outer interval, the same edge rule as `clampInterval`, and an empty outer interval contains nothing.
- Returns `false` if `intervalStart > intervalEnd` (invalid outer interval).
- Returns `false` if `innerStart > innerEnd` in 4-arg mode (invalid inner interval).
- Returns `false` on invalid input (wrong type, malformed strings, leap seconds).
- **Accepts mixed calendar systems** (E7's D4-zoned, issue #152): both bare ISO zoned strings and RFC 9557 calendar-annotated ones (`"2024-02-24T14:30:00+00:00[Europe/London][u-ca=hebrew]"`), and the endpoints need not agree on a calendar. Ordering is calendar-independent — verified that `Temporal.Instant` carries no calendar field at all and that `Instant.compare`/`ZonedDateTime.compare` both return `0` for the same instant expressed in hebrew, islamic-civil, japanese and iso8601.
- Rejects a calendar annotation before the time zone annotation, which is not RFC 9557.
- Compatibility: since 1.16.0 calendar strings are RFC 9557 (ISO digits, the `[u-ca=<id>]` annotation after the zone, canonical calendar ids); see `isValidCalendarZonedDateTime`.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `intervalStart` | `string` | ISO 8601 zoned datetime string for the outer interval start |
| `intervalEnd` | `string` | ISO 8601 zoned datetime string for the outer interval end |
| `pointOrStart` | `string` | ISO 8601 zoned datetime string for the point (3-arg) or inner start (4-arg) |
| `pointEnd` | `string` | optional ISO 8601 zoned datetime string for the inner interval end (4-arg mode) |

## Returns

true if the point or inner interval is contained, or false on invalid input

## Examples

```ts
import { intervalContainsZoned } from "@northguild/gmt/zoned/interval";

intervalContainsZoned("2024-01-01T00:00:00+00:00[UTC]", "2024-12-31T23:59:59+00:00[UTC]", "2024-06-15T12:00:00+00:00[UTC]") // true
```

## Source

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