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

refactor: add shared getDateString and time constants to fileUtils

Adam Eivyaf451807d448
diff --git a/server/lib/fileUtils.js b/server/lib/fileUtils.js
index 312a3416ef..c92c8ef5d3 100644
--- a/server/lib/fileUtils.js
+++ b/server/lib/fileUtils.js
@@ -278,6 +278,23 @@ export async function readJSONLFile(filePath, { logErrors = false } = {}) {
return safeJSONLParse(content, { logErrors, context: filePath });
}
+/**
+ * Time constants in milliseconds.
+ * Single source of truth — import these instead of declaring inline.
+ */
+export const HOUR = 60 * 60 * 1000;
+export const DAY = 24 * HOUR;
+
+/**
+ * Format a date as YYYY-MM-DD string.
+ *
+ * @param {Date} [date=new Date()] - Date to format
+ * @returns {string} ISO date string (e.g., "2026-03-05")
+ */
+export function getDateString(date = new Date()) {
+ return date.toISOString().split('T')[0];
+}
+
/**
* Format a duration in milliseconds to a human-readable string.
* Outputs the most appropriate unit (minutes, hours, days) based on size.