Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

564 B
Raw Blame
/** Compact relative timestamp for thin history rows: "now", "5m", "3h", "2d", "1w".
 *  Ported 1:1 from the web app so the recent-chats list on the
 *  desktop home screen reads exactly like the web one. */
export function timeAgo(ts: number, now: number = Date.now()): string {
  const s = Math.max(0, (now - ts) / 1000)
  if (s < 60) return 'now'
  const m = s / 60
  if (m < 60) return `${Math.floor(m)}m`
  const h = m / 60
  if (h < 24) return `${Math.floor(h)}h`
  const d = h / 24
  if (d < 7) return `${Math.floor(d)}d`
  return `${Math.floor(d / 7)}w`
}