core/time_format library

Functions

relativeTime(DateTime time, DateTime now) String
Formats time as a compact relative age from now (e.g. 5m ago, 2h ago, 3d ago). Pure for unit testing — the live caller passes DateTime.now().
untilExpiry(DateTime expiresAt, DateTime now) String
Formats a Duration until expiry as in 5m / in 2h / expired.