UNPKG

s2-tools

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

13 lines 563 B
/** * Convenience method to parse a GTFS date (YYYYMMDD) into a JavaScript Date. * Because GTFS dates do not contain timezone info, this function treats them as local dates. * @param yyyymmdd - A string in the format YYYYMMDD * @returns A JavaScript Date object */ export function parseGtfsDate(yyyymmdd) { const year = parseInt(yyyymmdd.slice(0, 4), 10); const month = parseInt(yyyymmdd.slice(4, 6), 10) - 1; // zero-based const day = parseInt(yyyymmdd.slice(6, 8), 10); return new Date(year, month, day); } //# sourceMappingURL=utils.js.map