Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(flows): add runTimestamp module

Steven Enamakel2ca376b97004
diff --git a/app/src/lib/flows/runTimestamp.ts b/app/src/lib/flows/runTimestamp.ts
new file mode 100644
index 0000000000..b254c983ba
--- /dev/null
+++ b/app/src/lib/flows/runTimestamp.ts
@@ -0,0 +1,23 @@
+/**
+ * Format a flow-run ISO timestamp for display: short month/day + time, in
+ * the viewer's locale. Returns `null` for a missing or unparsable value so
+ * callers can render nothing rather than "Invalid Date".
+ *
+ * Pass `withSeconds: true` for contexts (like a run inspector) precise
+ * enough that second-level resolution helps distinguish nearby events.
+ */
+export function formatRunTimestamp(
+ value: string | null | undefined,
+ options?: { withSeconds?: boolean }
+): string | null {
+ if (!value) return null;
+ const parsed = Date.parse(value);
+ if (!Number.isFinite(parsed)) return null;
+ return new Intl.DateTimeFormat(undefined, {
+ month: 'short',
+ day: 'numeric',
+ hour: 'numeric',
+ minute: '2-digit',
+ ...(options?.withSeconds ? { second: '2-digit' as const } : {}),
+ }).format(new Date(parsed));
+}