@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
18 lines (17 loc) • 717 B
JavaScript
import { parseUnitFromUnix } from "./parseUnitFromUnix.js";
/**
* Return the microsecond (0-999) from a unix epoch value.
*
* - Delegates to {@link parseUnitFromUnix} with unit "microsecond".
* - Returns "" for invalid input.
*
* @param value unix epoch in milliseconds or seconds (number or string)
* @param options optional: epochUnit ("seconds" | "milliseconds"), timeZone (IANA)
* @returns Microsecond (000-999) or "" on invalid input
*
* @example parseMicrosecondFromUnix(1700000000000) // "000"
* @example parseMicrosecondFromUnix(-86400, { epochUnit: "seconds" }) // "000"
*/
export function parseMicrosecondFromUnix(value, options) {
return parseUnitFromUnix(value, "microsecond", options);
}