Function assertValidDate

  • Asserts that the provided date parameters 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 date.

    • Optional minute: string | number

      The minute of the date.

    • Optional second: string | number

      The second of the date.

    • Optional millisecond: string | number

      The millisecond of the date.

    Returns void

    Throws

    Will throw an error if the date is not valid.

    Example

    assertValidDate(2021, 12, 31, 23, 59, 59, 999);;
    //=> true
    assertValidDate(2021, 13, 31, 23, 59, 59, 999);;
    //=> throws an error

Generated using TypeDoc