Peaktime - Overview

Peaktime calculates when to start a hike, bike ride, or trail run so you arrive at a summit or viewpoint during sunrise, golden hour, or blue hour. Give it a GPX file and a date, and it tells you what time to leave.

Reading Order

New to Peaktime? Start with Quick Start to install and run your first plan.

Want to understand the science? Read Sun Calculations for the solar algorithm, then the activity module that matches your sport.

Documentation

Page Description
Quick Start Install, basic usage, first plan
Sun Calculations NOAA algorithm, sun events, twilight phases
Hiking Models Naismith, Tobler, Langmuir, Munter; fitness levels; terrain
Cycling Physics-based bike model, FTP, bike types
Trail Running GAP model, pace calculations
GPX Parsing Parser API, route stats, waypoints
API Reference Full TypeScript API: types, functions, constants

Quick Start

1. Install

npm install peaktime

2. Plan a sunrise hike

import { parseGPXOrThrow, createPlanSummary, formatStartTime } from 'peaktime';
import { readFileSync } from 'fs';

const gpx = readFileSync('trail.gpx', 'utf-8');
const route = parseGPXOrThrow(gpx);

const summary = createPlanSummary(route, new Date('2026-06-21'), 'sunrise');

console.log(`Leave at ${formatStartTime(summary.plan.startTime, 'America/Denver')}`);
// → "Leave at 3:47 AM"