UNPKG

everyutil

Version:

A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.

15 lines (14 loc) 410 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseFlexibleDate = void 0; /** * Parses loosely formatted strings to a Date object. * @author @dailker * @param {string} str * @returns {Date|null} */ function parseFlexibleDate(str) { const d = new Date(str); return isNaN(d.getTime()) ? null : d; } exports.parseFlexibleDate = parseFlexibleDate;