# intervalContains

Industry: Core

## Signature

```ts
intervalContains(interval: Interval, isoString: string): boolean
```

Return true when an ISO 8601 instant string lies inside a half-open interval.

- `start ≤ t < end`: `start` is inside, `end` is not.
- Always `false` for an empty interval (`start === end`) — it contains no instant.
- Compares instants: `isoString` may be written with a different offset from either endpoint.
- The positional `intervalContainsUtc`, `intervalContainsZoned` (…) follow the same half-open rule and exclude `end`.
- Returns `false` on invalid input — `interval` not an `Interval`, or `isoString` not an instant string (offset required, no leap second, no annotation of any kind, such as `[Europe/Paris]` or `[u-ca=hebrew]`).

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `interval` | `Interval` | `{ start, end }` record of ISO 8601 instant strings |
| `isoString` | `string` | ISO 8601 instant string to test |

## Returns

true if the instant is inside the interval, or false on invalid input

## Related types

- [`Interval`](/gmt/reference/types/Interval/)

## Examples

```ts
import { intervalContains } from "@northguild/gmt/interval/compare";

intervalContains({ start: "2024-01-01T09:00:00Z", end: "2024-01-01T17:00:00Z" }, "2024-01-01T09:00:00Z") // true — start is inside
```

## Source

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