Function assertValidDateDay

  • Asserts that the provided day, month, and optional year form a valid date. If the date is not valid, it throws an error.

    Parameters

    • day: number

      The day of the month. Should be an integer between 1 and 31.

    • month: number

      The month of the year. Should be an integer between 1 and 12.

    • Optional year: number

      The year of the date. Optional parameter. If provided, should be a positive integer.

    Returns void

    Throws

    Will throw an error if the provided day, month, and optional year do not form a valid date.

    Example

    assertValidDateDay(31, 2, 2020);;
    //=> Error: Invalid day of the month: 31.
    assertValidDateDay(29, 2, 2020);;
    //=> no error

Generated using TypeDoc