startOrEndOfUnix
Signature
Section titled “Signature”startOrEndOfUnix(value: number, unit: any, options: { epochUnit?: "seconds" | "milliseconds"; timeZone?: string; weekStartsOn?: "monday" | "sunday"; disambiguation?: Disambiguation; offset?: Offset; }, isEnd: boolean): numberimport { startOrEndOfUnix } from "@northguild/gmt/unix/calculate";Internal shared implementation for startOfUnix / endOfUnix.
- Converts the epoch to a ZonedDateTime, snaps to the start or end of the requested unit, then converts back to an epoch number.
- Supports every Temporal
DateUnitandTimeUnit. epochUnitcontrols whether the input/output is interpreted as"milliseconds"(default) or"seconds".timeZonedefaults to the system time zone viagetSystemTimeZone().disambiguationandoffsetare forwarded to Temporal’s.with()for DST-gap/overlap boundaries; seestartOfUnix’s JSDoc for the full semantics — they behave identically here.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
number |
Unix epoch number |
unit |
any |
Temporal.DateUnit | Temporal.TimeUnit to snap to |
isEnd |
boolean |
false for start-of-unit, true for end-of-unit |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
epochUnit? |
"seconds" | "milliseconds" |
— |
timeZone? |
string |
— |
weekStartsOn? |
"monday" | "sunday" |
— |
disambiguation? |
Disambiguation |
— |
offset? |
Offset |
— |
Returns
Section titled “Returns”Unix epoch number, or null on invalid input