isBeforeUnix
Signature
Section titled “Signature”isBeforeUnix(value1: number, value2: number, options?: { epochUnit?: UnixUnit; }): booleanimport { isBeforeUnix } from "@northguild/gmt/unix/compare";Return whether value1 represents an instant strictly before value2.
- Uses Temporal.Instant.compare to check ordering.
- Returns false if either input is invalid.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value1 |
number |
first unix epoch value |
value2 |
number |
second unix epoch value |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
epochUnit? |
UnixUnit |
— |
Returns
Section titled “Returns”true if value1 is before value2, otherwise false
Related types
Section titled “Related types”Examples
Section titled “Examples”isBeforeUnix(1704067200, 1706659200) // trueisBeforeUnix(1706659200, 1706659200) // falseisBeforeUnix(-1, 0) // true (1969-12-31T23:59:59.999Z is before 1970-01-01T00:00:00Z)isBeforeUnix('invalid', 1704067200000) // falseisBeforeUnix(1704067200000, 'invalid') // false