UNPKG

@feugene/mu

Version:

Helpful TS utilities without dependencies

18 lines 758 B
/** * Parse a date from a strict ISO 8601/RFC 3339 string or epoch milliseconds. * Returns `Date` on success, otherwise `null`. * * Accepted examples: * - 2025-12-04T22:58:00Z * - 2025-12-04T22:58:00.123Z * - 2025-12-04T22:58:00+03:00 * - 2025-12-04 (treated as midnight UTC implicitly by JS engine) * - "1733353080000" (epoch ms as string) * - 1733353080000 (epoch ms as number) — use direct `new Date(ms)` instead of this helper * * Notes: * - Non-ISO human strings like "12/04/2025" are rejected to avoid ambiguous local vs UTC parsing. * - For strict timezone control, prefer passing/formatting in UTC (`toStringUTC`) or with `Intl`. */ export default function parseISO(input: string): Date | null; //# sourceMappingURL=parseISO.d.ts.map