UNPKG

@burglekitt/gmt

Version:

Temporal-based date and time utilities with timezone support and polyfill integration

18 lines (17 loc) 665 B
import { parseUnitFromUnix } from "./parseUnitFromUnix.js"; /** * Return the day of month (1-31) from a unix epoch value. * * - Delegates to {@link parseUnitFromUnix} with unit "day". * - Returns "" for invalid input. * * @param value unix epoch in milliseconds or seconds (number or string) * @param options optional: epochUnit ("seconds" | "milliseconds"), timeZone (IANA) * @returns Day (01-31) or "" on invalid input * * @example parseDayFromUnix(1700000000000) // "15" * @example parseDayFromUnix(-86400, { epochUnit: "seconds" }) // "31" */ export function parseDayFromUnix(value, options) { return parseUnitFromUnix(value, "day", options); }