MCPcopy Index your code
hub / github.com/agent0ai/agent-zero / formatTimestamp

Function formatTimestamp

plugins/_memory/webui/memory-dashboard-store.js:466–500  ·  view source on GitHub ↗
(timestamp, compact = false)

Source from the content-addressed store, hash-verified

464
465 // Utilities
466 formatTimestamp(timestamp, compact = false) {
467 if (!timestamp || timestamp === "unknown") {
468 return "Unknown";
469 }
470
471 const date = new Date(timestamp);
472 if (isNaN(date.getTime())) {
473 return "Invalid Date";
474 }
475
476 if (compact) {
477 const hour12 = getUserHour12();
478 // For table display: MM/DD HH:mm
479 return new Intl.DateTimeFormat("en-US", {
480 month: "2-digit",
481 day: "2-digit",
482 hour12,
483 hour: hour12 ? "numeric" : "2-digit",
484 minute: "2-digit",
485 timeZone: getUserTimezone(),
486 }).format(date);
487 } else {
488 const hour12 = getUserHour12();
489 // For details: Full format
490 return new Intl.DateTimeFormat("en-US", {
491 year: "numeric",
492 month: "long",
493 day: "numeric",
494 hour12,
495 hour: hour12 ? "numeric" : "2-digit",
496 minute: "2-digit",
497 timeZone: getUserTimezone(),
498 }).format(date);
499 }
500 },
501
502 formatTags(tags) {
503 if (!Array.isArray(tags) || tags.length === 0) return "None";

Callers

nothing calls this directly

Calls 2

getUserHour12Function · 0.90
getUserTimezoneFunction · 0.90

Tested by

no test coverage detected