UNPKG

@burglekitt/gmt

Version:

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

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