Function isDate

  • Checks if value is a Date object.

    Parameters

    • value: unknown

      The value to check.

    Returns value is Date

    Returns true if value is a Date object, false otherwise.

    const value1 = new Date();
    const value2 = '2024-01-01';

    console.log(isDate(value1)); // true
    console.log(isDate(value2)); // false