Source

dateTime/isDateString.js

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var isNum_1 = __importDefault(require("../number/isNum"));
/**
 * Check whether the string can be parsed by the Date constructor.
 *
 * @param dateStr
 * @category dateTime
 * @module isDateString
 */
var isDateString = function (dateStr) {
    // Empty string
    if (!dateStr)
        return false;
    var parsedDate = Date.parse(dateStr);
    if (((0, isNum_1.default)(parsedDate) && parsedDate > 0) || /^\d+$/g.test("".concat(parsedDate)))
        return true;
    return false;
};
exports.default = isDateString;