@peasant-labs/fairtrade 0.0.37 → 0.0.38

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.
@@ -1,5 +1,14 @@
1
1
  /**
2
- * Human-readable relative time: "3m ago", "2h ago", "4d ago", "Jan 12".
2
+ * Is this a real recorded time? A missing, unparseable, zero, epoch or Go zero-time value
3
+ * ("0001-01-01T00:00:00Z") is unknown: nothing may render it, and no "ago" math runs on it.
4
+ *
5
+ * @param {string | null | undefined} iso
6
+ * @returns {boolean}
7
+ */
8
+ export function isKnownTime(iso: string | null | undefined): boolean;
9
+ /**
10
+ * Human-readable relative time: "just now", "3m ago", "2h ago", "4d ago"; past a week it reads as
11
+ * a date ("oct 14", or "oct 14, 2025" in another year). An unknown time reads as nothing.
3
12
  *
4
13
  * @param {string} iso an ISO 8601 timestamp
5
14
  * @param {number} [now] reference "now" in epoch millis (defaults to `Date.now()`; pass explicitly for deterministic tests)
@@ -7,12 +16,28 @@
7
16
  */
8
17
  export function formatRelative(iso: string, now?: number): string;
9
18
  /**
10
- * A duration expressed in minutes → "1h 16m" / "9m" / "42s".
19
+ * The one duration format: human and short. "12s", "4m 30s", "4m", "1h 12m", "1h"; under a
20
+ * second "<1s"; zero, negative or unknown reads as nothing, so a caller hides the figure.
21
+ *
22
+ * @param {number | null | undefined} seconds
23
+ * @returns {string}
24
+ */
25
+ export function formatDurationSeconds(seconds: number | null | undefined): string;
26
+ /**
27
+ * A duration in minutes, in the one format: 4.5 -> "4m 30s", 76 -> "1h 16m", 0 -> "".
28
+ *
29
+ * @param {number | null | undefined} mins
30
+ * @returns {string}
31
+ */
32
+ export function formatDurationMins(mins: number | null | undefined): string;
33
+ /**
34
+ * A duration in milliseconds: a tool call reads "820ms" or "1.4s" while short, then the one
35
+ * format ("1m 15s"); zero or unknown reads as nothing.
11
36
  *
12
- * @param {number | undefined} mins
37
+ * @param {number | null | undefined} ms
13
38
  * @returns {string}
14
39
  */
15
- export function formatDurationMins(mins: number | undefined): string;
40
+ export function formatDurationMs(ms: number | null | undefined): string;
16
41
  /**
17
42
  * "Jan 12, 4:23 PM" — long datetime for tooltips.
18
43
  *