Function assertValidHours

  • Asserts that the given number is a valid hour (between 0 and 23). If the number is not a valid hour, it throws an error.

    Parameters

    • n: number

      The number to be validated.

    Returns void

    Throws

    Will throw an error if the number is not a valid hour.

    Example

    assertValidHours(12); // No error
    assertValidHours(24); // Throws Error: 'Expected hours to be between 0 and 23. Got: 24'

Generated using TypeDoc