isBetweenTime
Signature
Section titled “Signature”isBetweenTime(time: string, start: string, end: string, options?: { inclusiveStart?: boolean; inclusiveEnd?: boolean; }): booleanReturn true when time is between start and end (inclusive by default).
- Uses Temporal.PlainTime.compare to compare times.
- Returns false if start > end (invalid range).
- Returns false if any input is invalid.
- Note: PlainTime comparison does not account for day overflow.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
time | string | ISO PlainTime string to check |
start | string | ISO PlainTime string for the start of the range |
end | string | ISO PlainTime string for the end of the range |
Options
Section titled “Options”options
Whether each end of the range counts as inside it
| Option | Type | Default | Description |
|---|---|---|---|
inclusiveStart? | boolean | true | Whether time equal to start counts as inside the range. false requires it to be after start. |
inclusiveEnd? | boolean | true | Whether time equal to end counts as inside the range. false requires it to be before end. |
Returns
Section titled “Returns”boolean indicating whether time is between start and end
Examples
Section titled “Examples”import { isBetweenTime } from "@northguild/gmt/plain/compare";
isBetweenTime("12:34:56", "12:00:00", "13:00:00") // true