isValidUnixInterval
Signature
Section titled “Signature”isValidUnixInterval(start: string | number, end: string | number): booleanReturn true if start and end form a valid Unix interval — both safe-integer epochs and start <= end.
- Each input must be a safe integer (
Number.isSafeInteger) or a string of optionally negative ASCII digits naming one — the epoch grammar everyunix/function shares. - Fractional values,
NaN,±Infinityand anything beyond ±(2^53 − 1) returnfalse. - Strings with whitespace,
+, a decimal point, an exponent or hex digits returnfalse, and an empty string is not epoch 0. - Equal
start === endis valid.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
start | string | number | Unix epoch value, in the one unit all epoch arguments share — interval start |
end | string | number | Unix epoch value, in the one unit all epoch arguments share — interval end |
Returns
Section titled “Returns”true if start and end form a valid Unix interval, or false on invalid input
Examples
Section titled “Examples”import { isValidUnixInterval } from "@northguild/gmt/unix/interval";
isValidUnixInterval(0, 1700000000) // true