# isBetweenUnix

Industry: Core

## Signature

```ts
isBetweenUnix(value: string | number, start: string | number, end: string | number, options?: { epochUnit?: UnixUnit; timeZone?: string; inclusiveStart?: boolean; inclusiveEnd?: boolean; }): boolean
```

Return true when the Unix timestamp is between start and end (inclusive by default).

- Uses Temporal.Instant.compare for comparison.
- Returns false if start &gt; end or inputs are invalid.
- Each value is a safe integer or a digit string (`"1705000000000"`); anything else returns false.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` \| `number` | Unix epoch to check: a safe integer, or a string of optionally negative ASCII digits |
| `start` | `string` \| `number` | Unix epoch for range start, in the same form and unit |
| `end` | `string` \| `number` | Unix epoch for range end, in the same form and unit |

## Options

**options**

optional: how the epochs are read and whether each end of the range is included

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `epochUnit?` | `"seconds"` \| `"milliseconds"` \| `"second"` \| `"millisecond"` ([`UnixUnit`](/gmt/reference/types/UnixUnit/)) | `"milliseconds"` | The unit the epoch values are counted in: `"seconds"` or `"milliseconds"`, singular or plural. Any other value returns `false`. |
| `timeZone?` | `string` | `"UTC"` | A time zone that is validated only: the comparison is on exact instants, so the zone never changes the result. It is an IANA name, a UTC offset (a time zone identifier such as `+05:30`, `+0530` or `-08`, or a stored offset `±HH:MM[:SS]`, what `getTimeZoneOffset` returns), or `"local"` for the system time zone. An unknown zone returns `false`. |
| `inclusiveStart?` | `boolean` | `true` | Whether `value` equal to `start` counts as inside the range. `false` requires it to be after `start`. |
| `inclusiveEnd?` | `boolean` | `true` | Whether `value` equal to `end` counts as inside the range. `false` requires it to be before `end`. |

## Returns

boolean indicating whether value is between start and end

## Related types

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

## Examples

```ts
import { isBetweenUnix } from "@northguild/gmt/unix/calculate";

isBetweenUnix(1705000000000, 1704000000000, 1706000000000) // true
```

## Source

[unix/calculate/isBetweenUnix.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/unix/calculate/isBetweenUnix.ts)
