Function isValidDate

  • Checks if the provided date and time values form a valid date.

    Parameters

    • Optional year: string | number

      The year of the date.

    • Optional month: string | number

      The month of the date.

    • Optional day: string | number

      The day of the date.

    • Optional hour: string | number

      The hour of the time.

    • Optional minute: string | number

      The minute of the time.

    • Optional second: string | number

      The second of the time.

    • Optional millisecond: string | number

      The millisecond of the time.

    Returns boolean

    A boolean indicating whether the provided date and time values form a valid date.

    Example

    isValidDate(2021, 12, 31, 23, 59, 59, 999);;
    //=> true
    isValidDate('2021', '12', '31', '23', '59', '59', '999');;
    //=> true
    isValidDate(2021, 13, 31, 23, 59, 59, 999);;
    //=> false

Generated using TypeDoc