From eb8b63fc62b04ac505d72cd2c2d8e8cdb2427240 Mon Sep 17 00:00:00 2001 From: Rudy Celekli Date: Sun, 25 Oct 2026 11:32:12 -0400 Subject: [PATCH 1/7] fix(directions): show a 59.6-second leg as 1 min, not 60 s routeDurationText checked the raw seconds against 60 but printed them rounded, so a leg of 59.5 s or more read "60 s". Compare the rounded seconds so it moves to minutes. --- changelog.d/1385-route-duration-minute.md | 3 +++ src/data/directions.test.mjs | 2 ++ src/layers/directions/index.js | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog.d/1385-route-duration-minute.md diff --git a/changelog.d/1385-route-duration-minute.md b/changelog.d/1385-route-duration-minute.md new file mode 100644 index 000000000..fa354766b --- /dev/null +++ b/changelog.d/1385-route-duration-minute.md @@ -0,0 +1,3 @@ +- Show a route leg of 59.5 seconds or more as 1 min. The route summary and step + cards kept seconds below 60, then rounded 59.6 s up to "60 s" + (Rudy Celekli, @rudycelekli, #1385). diff --git a/src/data/directions.test.mjs b/src/data/directions.test.mjs index 4c9b54bd8..9426450a5 100644 --- a/src/data/directions.test.mjs +++ b/src/data/directions.test.mjs @@ -849,6 +849,8 @@ test('route numbers follow the page language and never break from their unit', ( assert.equal(routeDistanceText(1500), '1.5\u00a0km'); assert.equal(routeDistanceText(2_345_000), '2345\u00a0km'); assert.equal(routeDurationText(39), '39\u00a0s'); + assert.equal(routeDurationText(59.4), '59\u00a0s'); + assert.equal(routeDurationText(59.6), '1\u00a0min'); assert.equal(routeDurationText(3900), '1\u00a0h\u00a05\u00a0min'); assert.equal(routeDurationText(7200), '2\u00a0h'); assert.equal(routeDistanceText(-1), ''); diff --git a/src/layers/directions/index.js b/src/layers/directions/index.js index 2b8f8875e..8fec18f65 100644 --- a/src/layers/directions/index.js +++ b/src/layers/directions/index.js @@ -130,7 +130,8 @@ export function routeDistanceText(meters) { */ export function routeDurationText(seconds) { if (!Number.isFinite(seconds) || seconds < 0) return ''; - if (seconds < 60) return formatQuantity(Math.round(seconds), 's'); + const wholeSeconds = Math.round(seconds); + if (wholeSeconds < 60) return formatQuantity(wholeSeconds, 's'); const minutes = Math.round(seconds / 60); if (minutes < 60) return formatQuantity(minutes, 'min'); const hours = formatQuantity(Math.floor(minutes / 60), 'h'); From b7e00f18a4b1ef2f92fdd17fd4418b72f250aae0 Mon Sep 17 00:00:00 2001 From: Rudy Celekli Date: Sun, 25 Oct 2026 11:32:15 -0400 Subject: [PATCH 2/7] fix(directions): show a 996 m leg as 1.0 km, not 1000 m routeDistanceText checked the raw meters against 1000 but printed them rounded to tens, so 995 m or more read "1000 m". Compare the rounded value so it moves to kilometres. --- changelog.d/1386-route-distance-kilometre.md | 3 +++ src/data/directions.test.mjs | 2 ++ src/layers/directions/index.js | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog.d/1386-route-distance-kilometre.md diff --git a/changelog.d/1386-route-distance-kilometre.md b/changelog.d/1386-route-distance-kilometre.md new file mode 100644 index 000000000..0a60fcc62 --- /dev/null +++ b/changelog.d/1386-route-distance-kilometre.md @@ -0,0 +1,3 @@ +- Show a route leg of 995 m or more as 1.0 km. The route summary and step + cards kept meters below 1000, then rounded 996 m up to "1000 m" + (Rudy Celekli, @rudycelekli, #1386). diff --git a/src/data/directions.test.mjs b/src/data/directions.test.mjs index 4c9b54bd8..187f1a8d0 100644 --- a/src/data/directions.test.mjs +++ b/src/data/directions.test.mjs @@ -846,6 +846,8 @@ test('route numbers follow the page language and never break from their unit', ( t.after(() => setLocale('en')); assert.equal(routeDistanceText(8.4), '8\u00a0m'); assert.equal(routeDistanceText(236), '240\u00a0m'); + assert.equal(routeDistanceText(994), '990\u00a0m'); + assert.equal(routeDistanceText(996), '1.0\u00a0km'); assert.equal(routeDistanceText(1500), '1.5\u00a0km'); assert.equal(routeDistanceText(2_345_000), '2345\u00a0km'); assert.equal(routeDurationText(39), '39\u00a0s'); diff --git a/src/layers/directions/index.js b/src/layers/directions/index.js index 2b8f8875e..95e4cf258 100644 --- a/src/layers/directions/index.js +++ b/src/layers/directions/index.js @@ -112,7 +112,8 @@ export const FLIGHT_PROGRESS_MS = 250; export function routeDistanceText(meters) { if (!Number.isFinite(meters) || meters < 0) return ''; if (meters < 100) return formatQuantity(Math.round(meters), 'm'); - if (meters < 1000) return formatQuantity(Math.round(meters / 10) * 10, 'm'); + const tens = Math.round(meters / 10) * 10; + if (tens < 1000) return formatQuantity(tens, 'm'); const km = meters / 1000; return km < 10 ? formatQuantity(km, 'km', { From be869f916061017eadb251328829579e055c3a9a Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Sun, 25 Oct 2026 08:48:22 -0700 Subject: [PATCH 3/7] docs: document PR #1385 rounding behavior --- docs/CURRENT-STATE.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index be09e5664..848c6714f 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -4133,6 +4133,9 @@ and as the last line of the list, because the arrival step is among the ones dropped. A route of exactly 200 is complete, and a roundabout exit after the 200th keeps folding into it. +Route duration labels select their unit after rounding seconds: a leg of +59.5 seconds or more displays as `1 min`, rather than `60 s`. + A step's card opens from its dot on the globe or from its line in the list, and the list covers every step including departure and arrival, which have no dot. What a card needs is a resolved ground anchor: a step whose ground cell has not From d6ae581652effa0c207992ceaf57c68bf673b6e2 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Sun, 25 Oct 2026 08:48:30 -0700 Subject: [PATCH 4/7] docs: document PR #1386 rounding behavior --- docs/CURRENT-STATE.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index be09e5664..7543cb4f0 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -4081,6 +4081,9 @@ routing it shows `Routing…`, and a router miss reads The layer holds continuous render only while a route is drawn (the dashes animate). Disable clears all state. +Route distance labels round to the nearest ten metres before selecting the +unit, so 995 metres and above display as `1.0 km` rather than `1000 m`. + **Keys needed: none.** Directions works on a keyless boot, and the layer is off until the operator turns it on. From 4d64ac48bc20509075e31519019349386e275f8f Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Sun, 25 Oct 2026 08:48:58 -0700 Subject: [PATCH 5/7] docs: clarify unit transition examples --- docs/CURRENT-STATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 848c6714f..af916fcaf 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -4133,8 +4133,8 @@ and as the last line of the list, because the arrival step is among the ones dropped. A route of exactly 200 is complete, and a roundabout exit after the 200th keeps folding into it. -Route duration labels select their unit after rounding seconds: a leg of -59.5 seconds or more displays as `1 min`, rather than `60 s`. +Route duration labels select their unit after rounding seconds, switching to +minutes at 59.5 seconds; a 59.6-second leg displays as `1 min`, rather than `60 s`. A step's card opens from its dot on the globe or from its line in the list, and the list covers every step including departure and arrival, which have no dot. From 455dbf2b5f56932782bdb2b07ec435fabec9b559 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Sun, 25 Oct 2026 08:49:00 -0700 Subject: [PATCH 6/7] docs: clarify unit transition examples --- docs/CURRENT-STATE.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 7543cb4f0..f171806e0 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -4082,7 +4082,8 @@ The layer holds continuous render only while a route is drawn (the dashes animate). Disable clears all state. Route distance labels round to the nearest ten metres before selecting the -unit, so 995 metres and above display as `1.0 km` rather than `1000 m`. +unit, switching to kilometres at 995 metres; a 996-metre leg displays as +`1.0 km` rather than `1000 m`. **Keys needed: none.** Directions works on a keyless boot, and the layer is off until the operator turns it on. From 48e649a95e57a9ae6d4f02dd89b16c0237b2e0e6 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Sun, 25 Oct 2026 08:50:11 -0700 Subject: [PATCH 7/7] docs(directions): scope the distance rounding threshold precisely --- docs/CURRENT-STATE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index f171806e0..87fadd8a7 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -4081,9 +4081,9 @@ routing it shows `Routing…`, and a router miss reads The layer holds continuous render only while a route is drawn (the dashes animate). Disable clears all state. -Route distance labels round to the nearest ten metres before selecting the -unit, switching to kilometres at 995 metres; a 996-metre leg displays as -`1.0 km` rather than `1000 m`. +At the metre/kilometre boundary, route distance labels use the rounded +ten-metre value to select the unit, switching to kilometres at 995 metres; +a 996-metre leg displays as `1.0 km` rather than `1000 m`. **Keys needed: none.** Directions works on a keyless boot, and the layer is off until the operator turns it on.