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

#578 Measures: presentation and parsing per measure, and editor fields (#573)

–

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

Closes #573, part 2 of #570. Stacked on #577: until that merges, this diff includes its commit too. Each measure gets its own **printer and parser**, the counterpart of the time display. The editor gets a **Measures** dialog and a field per measure. ## Presentation (`src/measure-presentation.ts`) ```json "cost": { "type": "mpz", "label": "Cost", "presentation": { "mode": "fixed", "scale": "1/100", "decimals": 2, "prefix": "$" } } ``` - **Modes:** - `exact`, the default; - `fixed` decimals, for money: `123456` cents shows as `$1,234.56`; - `decimal` (significant digits); - `scientific`; - `si` (`1500` with unit `Wh` shows as `1.5 kWh`). Each mode takes a scale (shown = stored × scale), a prefix, a unit and thousands separators. - **Purposes:** - **Value and total:** as shown. - **Input:** exact, so text you don't change keeps its exact value. - **Tooltip:** adds the exact value where the label rounds, e.g. `0.33 (exactly 1/3)`. - **Axis:** abbreviated, e.g. `$1.23M`. - **Parsing:** - It accepts the prefix, the unit and commas. - It refuses text it would have to round: `$12.345` for a 2-decimal measure, or half a cent for a whole-number measure in cents. - It never uses floating point. ## Editor (`src/measure-ui.ts`) - **Measures dialog** (toolbar, or Tools on a phone): - **Fields per measure:** label, name (filled in from the label), whole numbers or fractions, and how it's shown. - **Feedback:** a live example, and a summary of what saving does to values ("Cost becomes Price", "the values of X are deleted"). - **Settings changes** (adding, restyling, widening) are recorded as settings edits and undone like others. - **Rewrites:** renaming, removing or narrowing rewrites values, in one of three places: - in the page, as one Undo; - in a large desktop file's store (undo restores the baseline); - on the server, through `POST /measures` with progress. This needs your other changes saved first. - **Forms:** moment and duration details get a field per measure, typed as shown and stored exactly. When the parser refuses a value, its reason is shown. - **Reader:** lists an event's values as each measure shows them. Not here: - **Hover cards, and the reader on server timelines:** values there need overview projections to carry `measures`, which goes with the overviews work in #575. - **Custom printers from plugins:** these go with the plugin API in #575. ## Tests - `test/measure-presentation.test.mjs` (unit). - `test/measures-browser.mjs`, in the browser suite: it declares a currency measure, types `$1,234.56`, refuses `12.345`, renames the measure with one Undo, and checks the reader in View mode. I ran it locally in Chromium. - OpenAPI gains `MeasurePresentation`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/circagraph/timeline-app/pull/578

Related

Open #578 Measures: presentation and parsing per measure, and editor fields (#573) in the timeline

#578 Measures: presentation and parsing per measure, and…