parseNanosecondFromUnix
Signature
Section titled “Signature”parseNanosecondFromUnix(value: string | number, options?: { epochUnit?: UnixUnit; timeZone?: string; }): stringReturn the nanosecond (0-999) from a unix epoch value.
- Delegates to {@link parseUnitFromUnix} with unit “nanosecond”.
valueis a safe integer or a digit string.- Returns "" for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | number | unix epoch in milliseconds or seconds: a safe integer, or a string of optionally negative ASCII digits |
Options
Section titled “Options”options
optional: how value is read and the zone its wall clock is read in
| 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 "". |
timeZone? | string | "UTC" | The time zone the wall-clock fields are read in: an IANA name, a UTC offset (a time zone identifier such as +05:30, +0530 or -08, or a stored offset ±HH:MM[:SS], what getTimeZoneOffset returns), or "local" for the system time zone. An unknown zone returns "". |
Returns
Section titled “Returns”Nanosecond field (0-999), zero-padded to 3 digits (“000”) as Temporal’s nanosecond field, or "" on invalid input
Related types
Section titled “Related types”Examples
Section titled “Examples”import { parseNanosecondFromUnix } from "@northguild/gmt/unix/parse";
parseNanosecondFromUnix(1700000000000) // "000"