You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: add .duration and .time_ago inline styles #814
find myself frequently formatting elapsed times and relative timestamps when building clis and storing them in the user_themes option, it would be useful to support these out of the box.
.duration : format seconds/timediff as human-readable duration
i.e {.duration {elapsed}} -> [2m 3s] / [42s]
.time_ago : format as relative time string
i.e {.time_ago {ts}} -> "2 minutes ago"
both can take advantage of vendored formatters in the package R/time.R and R/time-ago.R without dependencies, and would be consistent with the .bytes feature from #740
fyi: this might be a benign bug that doesnt affect anything
cli:::format_time$pretty_dt(as.difftime(90, units='secs'))
#> Error in `assert_diff_time()`:#> ! could not find function "assert_diff_time"cli:::format_time$pretty_dt(as.difftime(1.5, units='mins'))
#> Error in `assert_diff_time()`:#> ! could not find function "assert_diff_time"
Activity
jjjermiah commentedon Apr 22, 2026
fyi: this might be a benign bug that doesnt affect anything
Created on 2026-04-22 with reprex v2.1.1