isBeforeUnix
Signature
Section titled “Signature”isBeforeUnix(value1: string | number, value2: string | number, options?: { epochUnit?: UnixUnit; }): booleanReturn whether value1 represents an instant strictly before value2.
- Uses Temporal.Instant.compare to check ordering.
- Each value is a safe integer or a string of optionally negative ASCII digits; anything else is invalid.
- Returns false if either input is invalid.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value1 | string | number | first unix epoch: a safe integer or a digit string |
value2 | string | number | second unix epoch, in the same unit |
Options
Section titled “Options”options
optional: how both epochs are read
| Option | Type | Default | Description |
|---|---|---|---|
epochUnit? | "seconds" | "milliseconds" | "second" | "millisecond" (UnixUnit) | "milliseconds" | The unit the epoch values are counted in: "seconds" or "milliseconds", singular or plural. Any other value returns false. |
Returns
Section titled “Returns”true if value1 is before value2, otherwise false
Related types
Section titled “Related types”Examples
Section titled “Examples”import { isBeforeUnix } from "@northguild/gmt/unix/compare";
isBeforeUnix(1704067200, 1706659200) // true