From eb8b63fc62b04ac505d72cd2c2d8e8cdb2427240 Mon Sep 17 00:00:00 2001 From: Rudy Celekli Date: Sun, 25 Oct 2026 11:32:12 -0400 Subject: [PATCH 1/3] 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 be869f916061017eadb251328829579e055c3a9a Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Sun, 25 Oct 2026 08:48:22 -0700 Subject: [PATCH 2/3] 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 4d64ac48bc20509075e31519019349386e275f8f Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Sun, 25 Oct 2026 08:48:58 -0700 Subject: [PATCH 3/3] 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.