@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
19 lines (18 loc) • 861 B
TypeScript
/**
* Return true if `start` and `end` form a valid time interval — both parseable as
* ISO PlainTime strings and `start <= end`.
*
* - Both inputs must be ISO 8601 time strings (e.g. `"14:30:00"`).
* - Equal `start === end` is valid.
* - Invalid input, malformed strings, or leap-second strings return `false`.
*
* @param start ISO 8601 time string (interval start)
* @param end ISO 8601 time string (interval end)
* @returns true if start and end form a valid time interval, or false on invalid input
*
* @example isValidTimeInterval("09:00:00", "17:00:00") // true
* @example isValidTimeInterval("12:00:00", "12:00:00") // true
* @example isValidTimeInterval("17:00:00", "09:00:00") // false
* @example isValidTimeInterval("invalid", "12:00:00") // false
*/
export declare function isValidTimeInterval(start: string, end: string): boolean;