# isBetweenDateTime

Industry: Core

## Signature

```ts
isBetweenDateTime(dateTime: string, start: string, end: string, options?: { inclusiveStart?: boolean; inclusiveEnd?: boolean; }): boolean
```

Return true when `dateTime` is between `start` and `end` (inclusive by default).

- Uses Temporal.PlainDateTime.compare to compare date-times.
- Returns false if start &gt; end (invalid range).
- Returns false if any input is invalid.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `dateTime` | `string` | ISO PlainDateTime string to check |
| `start` | `string` | ISO PlainDateTime string for the start of the range |
| `end` | `string` | ISO PlainDateTime string for the end of the range |

## Options

**options**

Whether each end of the range counts as inside it

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `inclusiveStart?` | `boolean` | `true` | Whether `dateTime` equal to `start` counts as inside the range. `false` requires it to be after `start`. |
| `inclusiveEnd?` | `boolean` | `true` | Whether `dateTime` equal to `end` counts as inside the range. `false` requires it to be before `end`. |

## Returns

boolean indicating whether dateTime is between start and end

## Examples

```ts
import { isBetweenDateTime } from "@northguild/gmt/plain/compare";

isBetweenDateTime("2024-02-29T12:00:00", "2024-02-01T00:00:00", "2024-02-28T23:59:59") // false
```

## Source

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