@oss-autopilot/core - v1.6.3
    Preparing search index...

    Function formatRelativeTime

    • Formats a timestamp as a human-readable relative time string.

      Returns minutes for < 1 hour, hours for < 1 day, days for < 30 days, and a locale-formatted date string for anything older.

      Parameters

      • dateStr: string

        ISO 8601 date string

      Returns string

      Relative time like "5m ago", "3h ago", "12d ago", or a formatted date

      formatRelativeTime('2024-01-20T10:00:00Z')
      // "5d ago" (if called on Jan 25)
      formatRelativeTime(new Date(Date.now() - 120000).toISOString())
      // "2m ago"