Problem
The library currently formats relative time using full unit names, for example:
3 hours ago
5 minutes ago
2 days ago
In some UI contexts (mobile apps, compact lists, feeds, badges, etc.), a shorter representation would be preferable.
Proposed Solution
Add an option to format relative time using abbreviated units.
Example:
Current | Short Format
------------| -------
3 hours ago | 3 h ago
5 minutes ago | 5 min ago
2 days ago | 2 d ago
1 week ago | 1 wk ago
Possible API examples:
HumanReadable.timeAgo(now - 134.minutes, style = TimeStyle.SHORT)
Use Cases
Mobile applications with limited screen space
Lists and feeds with many timestamps
Compact UI components such as chips, cards, and notifications
Expected Output
3 h ago
15 min ago
2 d ago
1 wk ago
3 mo ago
1 yr ago
Additional Notes
The default behavior could remain unchanged to avoid breaking existing users, while the short format is exposed as an optional style/configuration.
The abbreviated units should ideally be localizable in the same way as the existing long-form units.
Problem
The library currently formats relative time using full unit names, for example:
3 hours ago5 minutes ago2 days agoIn some UI contexts (mobile apps, compact lists, feeds, badges, etc.), a shorter representation would be preferable.
Proposed Solution
Add an option to format relative time using abbreviated units.
Example:
Current | Short Format------------| -------
3 hours ago | 3 h ago
5 minutes ago | 5 min ago
2 days ago | 2 d ago
1 week ago | 1 wk ago
Possible API examples:
Mobile applications with limited screen space
Lists and feeds with many timestamps
Compact UI components such as chips, cards, and notifications
Expected Output
Additional Notes
The default behavior could remain unchanged to avoid breaking existing users, while the short format is exposed as an optional style/configuration.
The abbreviated units should ideally be localizable in the same way as the existing long-form units.