@oh-my-pi/pi-utils 18.8.7 → 18.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [18.8.8] - 2026-10-10
6
+
7
+ ### Fixed
8
+
9
+ - Fixed `formatDuration` printing `60.0s` for durations just under a minute; they now read `1m` ([#15121](https://github.com/can1357/oh-my-pi/pull/15121) by [@H4vC](https://github.com/H4vC))
10
+
5
11
  ## [18.8.7] - 2026-10-09
6
12
 
7
13
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-utils",
3
- "version": "18.8.7",
3
+ "version": "18.8.8",
4
4
  "description": "Shared utilities for pi packages",
5
5
  "keywords": [
6
6
  "cli",
@@ -57,7 +57,7 @@
57
57
  "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
58
58
  },
59
59
  "dependencies": {
60
- "@oh-my-pi/pi-natives": "18.8.7"
60
+ "@oh-my-pi/pi-natives": "18.8.8"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/bun": "^1.3.14"
package/src/format.ts CHANGED
@@ -10,7 +10,11 @@ const DAY = 24 * HOUR;
10
10
  export function formatDuration(ms: number): string {
11
11
  if (!Number.isFinite(ms) || ms <= 0) return "0ms";
12
12
  if (ms < SEC) return `${Math.floor(ms)}ms`;
13
- if (ms < MIN) return `${(ms / SEC).toFixed(1)}s`;
13
+ if (ms < MIN) {
14
+ // Round to tenths first: `toFixed(1)` alone turns 59.95s+ into an impossible `60.0s`.
15
+ const tenths = Math.round(ms / 100);
16
+ return tenths < 600 ? `${(tenths / 10).toFixed(1)}s` : "1m";
17
+ }
14
18
  if (ms < HOUR) {
15
19
  const mins = Math.floor(ms / MIN);
16
20
  const secs = Math.floor((ms % MIN) / SEC);