UNPKG

@simongrasinovski/str-utils

Version:

A lightweight utility library for effortless string manipulation. Simplify common tasks like case validation, conversion and formatting with easy-to-use functions that enhance your JavaScript applications

17 lines (16 loc) 397 B
"use strict"; /** * Checks if a string is a valid date. * * @function * @param {string} input - The string to valiate. * @returns {boolean} true if valid, false otherwise. * * @example * const result = isValidDate('2024-10-05'); * console.log(result); // true */ module.exports = function (input) { var parsedDate = new Date(input); return !isNaN(parsedDate.getTime()); };