isBetweenUtc
Signature
Section titled “Signature”isBetweenUtc(value: string, start: string, end: string, options?: { inclusiveStart?: boolean; inclusiveEnd?: boolean; }): booleanimport { isBetweenUtc } from "@northguild/gmt/utc/calculate";Return true when value is between start and end (inclusive by default).
- Uses Temporal.Instant.compare for comparison.
- Returns false if start > end or inputs are invalid.
- Use options.inclusiveStart/inclusiveEnd to control boundaries.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO UTC datetime string to check |
start |
string |
ISO UTC datetime string for range start |
end |
string |
ISO UTC datetime string for range end |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
inclusiveStart? |
boolean |
— |
inclusiveEnd? |
boolean |
— |
Returns
Section titled “Returns”boolean indicating whether value is between start and end
Examples
Section titled “Examples”isBetweenUtc("2024-03-15T12:00:00Z", "2024-03-10T12:00:00Z", "2024-03-20T12:00:00Z") // trueisBetweenUtc("2024-03-25T12:00:00Z", "2024-03-10T12:00:00Z", "2024-03-20T12:00:00Z") // falseisBetweenUtc("invalid", "2024-03-10T12:00:00Z", "2024-03-20T12:00:00Z") // false