UNPKG

@northguild/gmt

Version:

Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.

18 lines (16 loc) • 548 B
import { nowInstant } from "../../internal/temporalCompat/clock.js"; // src/utc/get/getUtcMicrosecond.ts /** * Return the current microsecond from UTC as a zero-padded string. * * - Uses nowInstant() converted to UTC zoned date time. * - Returns zero-padded string to 3 digits. * * @returns current microsecond string (zero-padded to 3 digits) * * @example getUtcMicrosecond() // "456" */ function getUtcMicrosecond() { return (nowInstant().toZonedDateTimeISO("UTC").microsecond ?? 0).toString().padStart(3, "0"); } export { getUtcMicrosecond };