Skip to content

parseGtfsTime

  • Public transport timetables in GTFS feeds, where a stop time runs past midnight and still belongs to the service day its trip began on.
parseGtfsTime(value: string): GtfsTime | null

Reads a GTFS Schedule Time value, keeping the days past the service day apart from the time of day.

  • Reads HH:MM:SS, H:MM:SS and HHH:MM:SS, hours up to 999; minutes and seconds 00 to 59.
  • 25:35:00 is 1:35 on the following day, still on the service day: dayOverflow counts the whole 24-hour blocks and seconds is what is left: the written time less those blocks.
  • Nothing is trimmed: a space, tab, newline or byte order mark returns null.
  • Reads the Time type only, not GTFS Local time (timeframes.txt).
  • Resolves no local time and needs no zone; that is the job of the service date and the agency’s zone. Source: GTFS Schedule Reference § Field Types, Time.
ParameterTypeDescription
valuestringA GTFS Time field, such as stop_times.txt arrival_time.

The written time less whole 24-hour blocks (seconds) and those blocks (dayOverflow), or null on invalid input (an empty field included)

import { parseGtfsTime } from "@northguild/gmt/rail/parse";
parseGtfsTime("25:35:00") // { seconds: 5700, dayOverflow: 1 }
output 

rail/parse/parseGtfsTime.ts

© 2026 NorthGuild · Licences

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.