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: make tribeCadence contract test timezone-independent

Adam Eivy235cfd3b00c8
diff --git a/client/src/lib/tribeCadence.contract.test.js b/client/src/lib/tribeCadence.contract.test.js
index 723d245945..7b7d1fb206 100644
--- a/client/src/lib/tribeCadence.contract.test.js
+++ b/client/src/lib/tribeCadence.contract.test.js
@@ -17,10 +17,17 @@ import {
} from '../../../server/lib/tribeCadence.js';
// N days before today as a YYYY-MM-DD string, so the suite is date-independent.
+// Build the string from LOCAL calendar fields — `daysSinceDate` parses the
+// `YYYY-MM-DD` in local time, so using `toISOString()` (UTC) here would shift
+// the date across the UTC/local day boundary in the evening and make the
+// elapsed-day math off-by-one (timezone-dependent flake).
function daysAgo(n) {
const d = new Date();
d.setDate(d.getDate() - n);
- return d.toISOString().slice(0, 10);
+ const y = d.getFullYear();
+ const m = String(d.getMonth() + 1).padStart(2, '0');
+ const day = String(d.getDate()).padStart(2, '0');
+ return `${y}-${m}-${day}`;
}
describe('tribeCadence — client/server mirror is byte-identical', () => {