@northguild/gmt
Version:
Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.
21 lines • 994 B
TypeScript
/**
* Checks a GTFS Schedule `Time` value, including one past `24:00:00`.
*
* - True for `H:MM:SS`, `HH:MM:SS` and `HHH:MM:SS` with hours 0–999 and minutes and seconds
* `00`–`59`.
* - `25:35:00` is valid: 1:35 on the following day, still on the same service day.
* - Nothing is trimmed, so a space or newline makes it false; an empty field is false.
* - True exactly when `parseGtfsTime` returns a value: both read the value with one internal core.
*
* Source: GTFS Schedule Reference § Field Types, Time.
*
* @param value A GTFS `Time` field, such as `frequencies.txt` `start_time`.
* @returns `true` when `value` is a GTFS time, or `false` on invalid input
*
* @example isValidGtfsTime("25:35:00") // true
* @example isValidGtfsTime("8:05:00") // true
* @example isValidGtfsTime("110:29:00") // true
* @example isValidGtfsTime("25:60:00") // false
* @example isValidGtfsTime("1000:00:00") // false
*/
export declare function isValidGtfsTime(value: string): boolean;