circagraph
Sign inSign up

openchronology/timeline-app on GitHub

The OpenChronology repository on GitHub, mirrored by och-import-github: issues and pull requests as durations (ongoing while open), what happened to them as moments, plus releases, milestones, commits and branches. The Branches view shows the most recently active branches each in a track of its own.

Source: https://github.com/openchronology/timeline-app

3,131 moments · 2026-10-05 CE 20:21:49 UTC – 2026-11-16 CE 12:10:45 UTC · by @athan · @athan

#317 Ruler labels take their detail from the tick's exact interval

–

  • github
  • github/openchronology/timeline-app
  • github/openchronology/timeline-app#317
  • pull request
  • state:merged

Closes #313. **Cause:** a tick's label detail came from its label resolution, the time per pixel times the label's pixel spacing. The app passed that spacing as `viewport.x(left + interval)`, a float. For a year-level tick, the resolution should be exactly one Julian year, which is the year-label threshold itself, so rounding landed it a hair either side, and the 1997 tick flipped between **1997 CE** and **1997-01 CE** with every tiny change of span. On a phone, two fingers are never perfectly still. Computed for the Harry Potter view at a phone width, the same year-level version alternated between the two every half-month of span, from 15 to 30 months. The day, hour and minute thresholds, and custom formats' `labelResolution()`, had the same tie; the Star Wars and Dune formats compare it to a year. **Fix:** - `PresentationContext` gains an optional `labelInterval`, the exact time between the labels a text is drawn for. It is validated as a positive rational. - A shared `labelResolution(context)` in `view-context.ts` uses it when given, and otherwise the old pixel product. Gregorian precision and custom formats' `api.labelResolution()` both use it. - `calendarContext` maps it into displayed units like the span. - The ruler passes each tick version's interval (`src/app.ts`, about 10 lines). The pixel spacing is still passed for anything that uses it. **Tests:** - New unit test in `test/context.test.mjs`. It labels the 1997 tick as the app does, sweeps the span from 4 months to 2.5 years in twentieths of a month, and requires the label to change exactly once, from `1997-01 CE` to `1997 CE`. It fails without the interval, the old behaviour, which had about 20 flips. It also checks that a custom format's `labelResolution()` is the exact interval, and that a zero interval is refused. - In a browser at 390×844 with the Harry Potter timeline, panning at nine spans from 7.5 to 23.5 months: each span keeps one label, and the switch happens once between spans. Before, the 23-month view had flipped back. - `test/presentation-browser.mjs` had asserted that every tick in a 100-second view reads `mm ss`. On a narrow stage, where minute labels are fading in, the 00:00 tick's minute version wins the crossfade, and with an exact one-minute resolution it now prints `00m`, as a minute ruler does. Before, the float happened to leave it a hair under a minute. The check now allows that tick's `00m` and still requires seconds on the rest. - Results: - `npm test`: 323 pass. The plugin-sandbox time/memory test failed once under load, then passed on its own. - `npm run build` passes. - `test/browser.mjs` passes in Firefox and WebKit. In Chromium the presentation and ruler checks pass, and the suite then hits the known duration-menu flake #308. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/openchronology/timeline-app/pull/317

Related

Open #317 Ruler labels take their detail from the tick's exact interval in the timeline

#317 Ruler labels take their detail from the tick's exact…