Toolbox-XToolbox-X

Check Formatted Time

Type guard that checks if a value is a valid time string in "HH:MM" format.

isValidTime

Type guard that checks if a value is a valid time string in "HH:MM" format.

Function Signature

isValidTime(value: unknown): value is Time;

Parameters

  • value: The value to check (any type)

Returns

true if the value is a valid 24-hour time string, false otherwise

Example Usage

playground.ts

Validation Rules

  1. Must be a string in "HH:MM" format
  2. Hours must be between 00-23
  3. Minutes must be between 00-59
  4. Leading zeros required for single-digit values

Alias

  • isValidTimeString

Type Definition

type ClockTime = `${ClockHour}:${ClockMinute}`;
type ClockHour = '00'|'01'|...|'23';
type ClockMinute = '00'|'01'|...|'59';

Last updated: Fri, May 22, 2026 07:46:19AM (Coordinated Universal Time)

On this page