UNPKG

minotor

Version:

A lightweight client-side transit routing library.

18 lines (17 loc) 722 B
import { DateTime } from 'luxon'; import { Time } from '../timetable/time.js'; export type GtfsDate = number; export type GtfsTime = string; export declare const toGtfsDate: (date: DateTime) => GtfsDate; /** * Converts a time string in the format 'HH:mm:ss' to a Time object * (number of seconds since midnight). * * This method splits the input time string into hours, minutes, and seconds, * and then calculates the total number of seconds. * * @param time - A string representing the time in 'HH:mm:ss' format. * @returns The GTFS time as the number of seconds since midnight. * @throws An error if the input time string is not in the correct format. */ export declare const toTime: (time: GtfsTime) => Time;