Function isValidTime

  • Checks if the provided hours, minutes, seconds, and milliseconds represent a valid time.

    Parameters

    • hours: number

      The hours component of the time. Must be an integer between 0 and 23.

    • minutes: number

      The minutes component of the time. Must be an integer between 0 and 59.

    • seconds: number

      The seconds component of the time. Must be an integer between 0 and 59.

    • milliseconds: number

      The milliseconds component of the time. Must be an integer between 0 and 999.

    Returns boolean

    A boolean indicating whether the provided values represent a valid time.

    Remarks

    This function will return false if any of the provided values are out of range for their respective units of time.

    Example

    isValidTime(12, 30, 15, 500);  // returns true
    isValidTime(24, 0, 0, 0); // returns false

Generated using TypeDoc