npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gb-transit/gtfs-schema

v2.2.0

Published

The shape of a GTFS feed - one type per file, and the scalars they are written in

Downloads

387

Readme

@gb-transit/gtfs-schema

The shape of a GTFS feed — one type per file, and the scalars they are written in.

npm install @gb-transit/gtfs-schema

Types only, near enough: an interface for every entity a feed publishes, a Row type for every file it writes, three enums for the coded columns, and the two scalar modules the rest is expressed in. Its one dependency is temporal-polyfill, which the date helpers are written against so that a runtime without a Temporal global still has one; @gb-transit/gtfs-schema/scalars does not reach it and depends on nothing at all.

That is the point of it. @gb-transit/gtfs holds the transit model, the schedule transforms and the build, and to do the DTD's coordinates it pulls in proj4; its calendar is typed against Temporal. A consumer that wants only the vocabulary — to name the shape of a feed it is reading, or to agree with this project about what a duration is — should not have to take any of that. So the vocabulary lives here and @gb-transit/gtfs re-exports it, which means every name below is importable from either package and they cannot disagree.

Usage

import {parseDuration, RouteType, type Stop, type StopTime} from "@gb-transit/gtfs-schema";

const seconds = parseDuration("25:30:00");   // 91800 - GTFS times are not capped at 24 hours

What is in it

Entities. Agency, Area, Attribution, Calendar, CalendarDate, FeedInfo, FixedLink, Route, Stop, StopTime, Transfer, Trip, and the …Row type each is written as. The two differ where the build carries a field it does not publish: a StopTime knows its platform and timing point, and toStopTimeRow in @gb-transit/gtfs turns those into the stop id.

FeedRow is the union of every row type, which is how the writers say what file they are given.

Enums. RouteType, TransferType, PickupDropOffType.

Scalars. Duration is seconds. parseDuration reads "HH:MM" or "HH:MM:SS" and does not cap the hours, because GTFS uses "25:30:00" for a call after midnight; formatDuration writes one back. DayOfWeek is Sunday-first — deliberately not Temporal's ISO numbering, because the GTFS calendar columns and the CIF schedule rows both start on Sunday. compare, maxDate, minDate, dayOfWeek and toYYYYMMDD are the Temporal.PlainDate operations this project needs and Temporal does not provide.

Identifiers. TUID and RSID are CIF names — train unique identifier and retail service identifier — that end up on trips.txt, so Trip needs them.

Two builds

This package publishes both CommonJS and ESM, unlike the rest of the repository, because @gb-transit/gtfs-loader runs in a browser and depends on it. Its imports carry explicit .js extensions for the same reason: node's ESM loader requires them.

Contributing

Issues, pull requests and the source live at planarnetwork/gb-transit. This is libs/gtfs-schema in that repository.

License

This software is licensed under GNU GPLv3.

Copyright 2017 Linus Norton.