# intervalsOverlapDateTime

Industry: Core

## Signature

```ts
intervalsOverlapDateTime(aStart: string, aEnd: string, bStart: string, bEnd: string): boolean
```

Return true when the half-open datetime intervals `[aStart, aEnd)` and `[bStart, bEnd)` share at least one moment.

- Half-open: an interval holds every `t` with `start <= t < end`, so `end` itself is not in it (the rule CORE-6's `intervalsOverlap` uses). The test is `aStart < bEnd && bStart < aEnd`.
- Touching intervals (`aEnd` equal to `bStart`) share no moment and do not overlap.
- An empty interval (`start === end`) overlaps only an interval it lies strictly inside.
- Uses `Temporal.PlainDateTime.compare` for comparison.
- Returns `false` if either interval is invalid (`start > end`).
- Returns `false` on invalid input (wrong type, malformed strings).

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `aStart` | `string` | ISO 8601 datetime string for the first interval start |
| `aEnd` | `string` | ISO 8601 datetime string for the first interval end (excluded) |
| `bStart` | `string` | ISO 8601 datetime string for the second interval start |
| `bEnd` | `string` | ISO 8601 datetime string for the second interval end (excluded) |

## Returns

true if intervals overlap, or false on invalid input

## Examples

```ts
import { intervalsOverlapDateTime } from "@northguild/gmt/plain/interval";

intervalsOverlapDateTime("2024-01-01T09:00:00", "2024-01-01T13:00:00", "2024-01-01T12:00:00", "2024-01-01T17:00:00") // true
```

## Source

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