@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.
15 lines (13 loc) • 429 B
JavaScript
import { nowInstant } from "../../internal/temporalCompat/clock.js";
import { resolveUnixEpochUnitOptions, toUnixEpoch } from "../../internal/unixEpochValue.js";
// src/unix/get/getUnixNow.ts
function getUnixNow(options) {
try {
const epochUnit = resolveUnixEpochUnitOptions(options);
if (epochUnit === null) return null;
return toUnixEpoch(nowInstant(), epochUnit);
} catch {
return null;
}
}
export { getUnixNow };