Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix([migrate-two-remaining-local-formatters]): address copilot re-review — JSDoc nullable param + lock passthrough

Adam Eivyd9174bfab4d3
diff --git a/client/src/utils/formatters.js b/client/src/utils/formatters.js
index 7c9e51212b..fc49a339c3 100644
--- a/client/src/utils/formatters.js
+++ b/client/src/utils/formatters.js
@@ -239,7 +239,7 @@ export function formatDurationMs(ms) {
/**
* Format a duration in minutes as a human-readable string
- * @param {number} minutes - Duration in minutes
+ * @param {number|null|undefined} minutes - Duration in minutes; nullish → ''
* @param {object} [options]
* @param {boolean} [options.approximate=false] - Prefix the result with `~`
* to signal an estimate (e.g., "~1h 30m") for predicted/averaged durations.
diff --git a/client/src/utils/formatters.test.js b/client/src/utils/formatters.test.js
index 107b88dd09..f9711dbf6e 100644
--- a/client/src/utils/formatters.test.js
+++ b/client/src/utils/formatters.test.js
@@ -54,4 +54,14 @@ describe('formatEventDateTime', () => {
it('tolerates a null options argument', () => {
expect(formatEventDateTime(sample, null)).toBe(formatEventDateTime(sample));
});
+
+ it('passes malformed input straight through, like the original local formatter (no guard, by design)', () => {
+ // The migration is deliberately behavior-identical: unparseable input
+ // yields the raw toLocaleString result ("Invalid Date"), not an empty
+ // string. Locks the no-guard decision so a future change does not re-add
+ // a guard and silently alter the (unreachable) degenerate path.
+ expect(formatEventDateTime('not-a-date')).toBe(
+ new Date('not-a-date').toLocaleString([], { weekday: 'short', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' })
+ );
+ });
});