formatAgo

fun formatAgo(lastSeenUnixSeconds: Int, unknownText: String, nowText: String): String(source)

Formats a given Unix timestamp (in seconds) into a relative "time ago" string.

For durations less than a minute, it returns nowText. For longer durations, it uses DateFormatter to generate a concise, localized representation (e.g., "5m ago", "2h ago").

Return

A String representing the relative time that has passed.

Parameters

lastSeenUnixSeconds

The Unix timestamp in seconds to be formatted.

unknownText

Text to display when the timestamp is invalid (≤ 0).

nowText

Text to display when the duration is less than a minute.


fun formatAgo(lastSeenUnixSeconds: Int): String(source)

Composable convenience overload that resolves string resources automatically.